New option `org-export-date-timestamp-format'.

* org-exp.el (org-export-date-timestamp-format): New option to
define the way a timestamp in #+DATE will be exported.
(org-infile-export-plist): Use the new option.

Thanks to Torsten Wagner for this idea.
This commit is contained in:
Bastien Guerry 2011-12-28 17:12:25 +01:00
parent 371b0cf9aa
commit e9e249ea49
2 changed files with 19 additions and 4 deletions

View File

@ -9634,10 +9634,11 @@ Insert template with export options, see example below.
@vindex user-full-name
@vindex user-mail-address
@vindex org-export-default-language
@vindex org-export-date-timestamp-format
@example
#+TITLE: the title to be shown (default is the buffer name)
#+AUTHOR: the author (default taken from @code{user-full-name})
#+DATE: a date, fixed, or a format string for @code{format-time-string}
#+DATE: a date, an Org timestamp@footnote{@code{org-export-date-timestamp-format} defines how this timestamp will be exported.}, or a format string for @code{format-time-string}
#+EMAIL: his/her email address (default from @code{user-mail-address})
#+DESCRIPTION: the page description, e.g.@: for the XHTML meta tag
#+KEYWORDS: the page keywords, e.g.@: for the XHTML meta tag
@ -9656,8 +9657,8 @@ Insert template with export options, see example below.
@end example
@noindent
The OPTIONS line is a compact@footnote{If you want to configure many options
this way, you can use several OPTIONS lines.} form to specify export
The @code{#+OPTIONS} line is a compact@footnote{If you want to configure many options
this way, you can use several @code{#+OPTIONS} lines.} form to specify export
settings. Here you can:
@cindex headline levels
@cindex section-numbers

View File

@ -217,6 +217,11 @@ and in `org-clock-clocktable-language-setup'."
:group 'org-export-general
:type 'string)
(defcustom org-export-date-timestamp-format "%Y-%m-%d"
"Time string format for Org timestamps in the #+DATE option."
:group 'org-export-general
:type 'string)
(defvar org-export-page-description ""
"The page description, for the XHTML meta tag.
This is best set with the #+DESCRIPTION line in a file, it does not make
@ -726,6 +731,7 @@ must accept the property list as an argument, and must return the (possibly
modified) list.")
;; FIXME: should we fold case here?
(defun org-infile-export-plist ()
"Return the property list with file-local settings for export."
(save-excursion
@ -759,7 +765,15 @@ modified) list.")
((string-equal key "TITLE") (setq p (plist-put p :title val)))
((string-equal key "AUTHOR")(setq p (plist-put p :author val)))
((string-equal key "EMAIL") (setq p (plist-put p :email val)))
((string-equal key "DATE") (setq p (plist-put p :date val)))
((string-equal key "DATE")
;; If date is an Org timestamp, convert it to a time
;; string using `org-export-date-timestamp-format'
(when (string-match org-ts-regexp3 val)
(setq val (format-time-string
org-export-date-timestamp-format
(apply 'encode-time (org-parse-time-string
(match-string 0 val))))))
(setq p (plist-put p :date val)))
((string-equal key "KEYWORDS") (setq p (plist-put p :keywords val)))
((string-equal key "DESCRIPTION")
(setq p (plist-put p :description val)))