ox-html: Fix %d placeholder in pre/postamble string

* lisp/ox-html.el (org-html-format-spec): Correctly apply
  `org-html-metadata-timestamp-format' on %d placeholder.

Reported-by: Pavel Panchekha <me@pavpanchekha.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/110374>
This commit is contained in:
Nicolas Goaziou 2016-11-19 23:17:32 +01:00
parent c3c33841eb
commit 1319a3be44

View file

@ -1875,25 +1875,24 @@ INFO is a plist used as a communication channel."
(setq template (replace-match val t t template)))))))) (setq template (replace-match val t t template))))))))
(defun org-html-format-spec (info) (defun org-html-format-spec (info)
"Return format specification for elements that can be "Return format specification for preamble and postamble.
used in the preamble or postamble." INFO is a plist used as a communication channel."
(let ((timestamp-format (plist-get info :html-metadata-timestamp-format)))
`((?t . ,(org-export-data (plist-get info :title) info)) `((?t . ,(org-export-data (plist-get info :title) info))
(?s . ,(org-export-data (plist-get info :subtitle) info)) (?s . ,(org-export-data (plist-get info :subtitle) info))
(?d . ,(org-export-data (org-export-get-date info) info)) (?d . ,(org-export-data (org-export-get-date info timestamp-format)
(?T . ,(format-time-string info))
(plist-get info :html-metadata-timestamp-format))) (?T . ,(format-time-string timestamp-format))
(?a . ,(org-export-data (plist-get info :author) info)) (?a . ,(org-export-data (plist-get info :author) info))
(?e . ,(mapconcat (?e . ,(mapconcat
(lambda (e) (lambda (e) (format "<a href=\"mailto:%s\">%s</a>" e e))
(format "<a href=\"mailto:%s\">%s</a>" e e))
(split-string (plist-get info :email) ",+ *") (split-string (plist-get info :email) ",+ *")
", ")) ", "))
(?c . ,(plist-get info :creator)) (?c . ,(plist-get info :creator))
(?C . ,(let ((file (plist-get info :input-file))) (?C . ,(let ((file (plist-get info :input-file)))
(format-time-string (format-time-string timestamp-format
(plist-get info :html-metadata-timestamp-format) (and file (nth 5 (file-attributes file))))))
(when file (nth 5 (file-attributes file)))))) (?v . ,(or (plist-get info :html-validation-link) "")))))
(?v . ,(or (plist-get info :html-validation-link) ""))))
(defun org-html--build-pre/postamble (type info) (defun org-html--build-pre/postamble (type info)
"Return document preamble or postamble as a string, or nil. "Return document preamble or postamble as a string, or nil.