summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-01-30 21:41:38 (GMT)
committer Nicolas Goaziou <n.goaziou@gmail.com>2013-01-30 21:41:38 (GMT)
commitb9c506b41e5d989241263b824ce9b8fb5182f1af (patch)
tree5b20fb37bf3741571b26178f607651fd7d769302
parentab4932491787d386a4c438960d97a72b0f59eadc (diff)
downloadorg-mode-b9c506b41e5d989241263b824ce9b8fb5182f1af.zip
org-mode-b9c506b41e5d989241263b824ce9b8fb5182f1af.tar.gz
org-e-latex: Allow to provide a format string for date keyword
* contrib/lisp/org-e-latex.el (org-e-latex-date-timestamp-format): New variable. (org-e-latex-date-format): Removed variable. (org-e-latex-template): Allow to provide a format string iff date consists in a single timestamp.
-rw-r--r--contrib/lisp/org-e-latex.el32
1 files changed, 24 insertions, 8 deletions
diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el
index 14f21e2..f115a6d 100644
--- a/contrib/lisp/org-e-latex.el
+++ b/contrib/lisp/org-e-latex.el
@@ -161,7 +161,8 @@
(lambda (a s v b)
(if a (org-e-latex-export-to-pdf t s v b)
(org-open-file (org-e-latex-export-to-pdf nil s v b)))))))
- :options-alist ((:date "DATE" nil org-e-latex-date-format t)
+ :options-alist ((:date "DATE" nil "\\today" t)
+ (:date-format nil nil org-e-latex-date-timestamp-format)
(:latex-class "LATEX_CLASS" nil org-e-latex-default-class t)
(:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
(:latex-header-extra "LATEX_HEADER" nil nil newline)
@@ -379,11 +380,18 @@ are written as utf8 files."
(string :tag "Derived from buffer")
(string :tag "Use this instead"))))
-(defcustom org-e-latex-date-format
- "\\today"
- "Format string for \\date{...}."
+(defcustom org-e-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-e-latex
- :type 'boolean)
+ :type '(choice
+ (string :tag "Time-stamp format string")
+ (const :tag "No format string" nil)))
(defcustom org-e-latex-title-command "\\maketitle"
"The command used to insert the title just after \\begin{document}.
@@ -1118,9 +1126,17 @@ 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)
- (org-export-data (plist-get info :date) info))))
- (format "\\date{%s}\n" (or 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)))))
;; Title
(format "\\title{%s}\n" title)
;; Hyperref options.