瀏覽代碼

export back-ends: Handle DATE keyword in a uniform way

* lisp/ox-ascii.el (org-ascii-template--document-title): Use new function.
* lisp/ox-beamer.el (org-beamer-template): Use new function.
* lisp/ox-html.el (org-html-format-spec): Use new function.
* lisp/ox-latex.el (org-latex-template): Use new function.
(org-latex-date-timestamp-format): Remove variable.

The uniform way is to format DATE according to
`org-export-date-timestamp-format' when keyword value consists in
a single timestamp.
Nicolas Goaziou 12 年之前
父節點
當前提交
e7bf989b28
共有 4 個文件被更改,包括 7 次插入39 次删除
  1. 1 1
      lisp/ox-ascii.el
  2. 2 11
      lisp/ox-beamer.el
  3. 1 1
      lisp/ox-html.el
  4. 3 26
      lisp/ox-latex.el

+ 1 - 1
lisp/ox-ascii.el

@@ -880,7 +880,7 @@ INFO is a plist used as a communication channel."
 	 (email (and (plist-get info :with-email)
 		     (org-export-data (plist-get info :email) info)))
 	 (date (and (plist-get info :with-date)
-		    (org-export-data (plist-get info :date) info))))
+		    (org-export-data (org-export-get-date info) info))))
     ;; There are two types of title blocks depending on the presence
     ;; of a title to display.
     (if (string= title "")

+ 2 - 11
lisp/ox-beamer.el

@@ -899,17 +899,8 @@ holding export options."
 	     (author (format "\\author{%s}\n" author))
 	     (t "\\author{}\n")))
      ;; 6. Date.
-     (let ((date (and (plist-get info :with-date) (plist-get info :date))))
-       (format "\\date{%s}\n"
-	       (cond ((not date) "")
-		     ;; If `:date' consists in a single timestamp and
-		     ;; `:date-format' is provided, apply it.
-		     ((and (plist-get info :date-format)
-			   (not (cdr date))
-			   (eq (org-element-type (car date)) 'timestamp))
-		      (org-timestamp-format
-		       (car date) (plist-get info :date-format)))
-		     (t (org-export-data date info)))))
+     (let ((date (and (plist-get info :with-date) (org-export-get-date info))))
+       (format "\\date{%s}\n" (org-export-data date info)))
      ;; 7. Title
      (format "\\title{%s}\n" title)
      ;; 8. Hyperref options.

+ 1 - 1
lisp/ox-html.el

@@ -1496,7 +1496,7 @@ INFO is a plist used as a communication channel."
   "Return format specification for elements that can be
 used in the preamble or postamble."
   `((?t . ,(org-export-data (plist-get info :title) info))
-    (?d . ,(org-export-data (plist-get info :date) info))
+    (?d . ,(org-export-data (org-export-get-date info) info))
     (?T . ,(format-time-string org-html--timestamp-format))
     (?a . ,(org-export-data (plist-get info :author) info))
     (?e . ,(mapconcat

+ 3 - 26
lisp/ox-latex.el

@@ -185,8 +185,7 @@
 	    (lambda (a s v b)
 	      (if a (org-latex-export-to-pdf t s v b)
 		(org-open-file (org-latex-export-to-pdf nil s v b)))))))
-  :options-alist '((:date-format nil nil org-latex-date-timestamp-format)
-		   (:latex-class "LATEX_CLASS" nil org-latex-default-class t)
+  :options-alist '((:latex-class "LATEX_CLASS" nil org-latex-default-class t)
 		   (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
 		   (:latex-header "LATEX_HEADER" nil nil newline)
 		   (:latex-header-extra "LATEX_HEADER_EXTRA" nil nil newline)
@@ -406,19 +405,6 @@ are written as utf8 files."
 	   (string :tag "Derived from buffer")
 	   (string :tag "Use this instead"))))
 
-(defcustom org-latex-date-timestamp-format nil
-  "Time-stamp format string to use for DATE keyword.
-
-The format string, when specified, only applies if date consists
-in a single time-stamp.  Otherwise its value will be ignored.
-
-See `format-time-string' for details on how to build this
-string."
-  :group 'org-export-latex
-  :type '(choice
-	  (string :tag "Time-stamp format string")
-	  (const :tag "No format string" nil)))
-
 (defcustom org-latex-title-command "\\maketitle"
   "The command used to insert the title just after \\begin{document}.
 If this string contains the formatting specification \"%s\" then
@@ -1199,17 +1185,8 @@ holding export options."
 	      (format "\\author{%s\\thanks{%s}}\n" author email))
 	     ((or author email) (format "\\author{%s}\n" (or author email)))))
      ;; Date.
-     (let ((date (and (plist-get info :with-date) (plist-get info :date))))
-       (format "\\date{%s}\n"
-	       (cond ((not date) "")
-		     ;; If `:date' consists in a single timestamp and
-		     ;; `:date-format' is provided, apply it.
-		     ((and (plist-get info :date-format)
-			   (not (cdr date))
-			   (eq (org-element-type (car date)) 'timestamp))
-		      (org-timestamp-format
-		       (car date) (plist-get info :date-format)))
-		     (t (org-export-data date info)))))
+     (let ((date (and (plist-get info :with-date) (org-export-get-date info))))
+       (format "\\date{%s}\n" (org-export-data date info)))
      ;; Title
      (format "\\title{%s}\n" title)
      ;; Hyperref options.