From 9aec216b04137265725835ce7d5ab193d0a1cd94 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Mon, 12 Dec 2011 18:37:09 +0100 Subject: [PATCH] Revert "Fix bug when inserting the output of a custom function for the pre/postamble." This reverts commit 701830d5a2681ba0ff2e5112fbd4279eb958801a. --- lisp/org-html.el | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index c304a2b36..3724cfc1e 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1352,21 +1352,28 @@ PUB-DIR is set, use this as the publishing directory." (when (plist-get opt-plist :html-preamble) (let ((html-pre (plist-get opt-plist :html-preamble)) html-pre-real-contents) - (setq html-pre-real-contents - (if (stringp html-pre) - (format-spec html-pre `((?t . ,title) (?a . ,author) - (?d . ,date) (?e . ,email))) + (cond ((stringp html-pre) + (setq html-pre-real-contents + (format-spec html-pre `((?t . ,title) (?a . ,author) + (?d . ,date) (?e . ,email))))) + ((functionp html-pre) + (insert "
\n") + (funcall html-pre) + (insert "\n
\n")) + (t + (setq html-pre-real-contents (format-spec (or (cadr (assoc (nth 0 lang-words) org-export-html-preamble-format)) (cadr (assoc "en" org-export-html-preamble-format))) `((?t . ,title) (?a . ,author) - (?d . ,date) (?e . ,email))))) - ;; Always insert the preamble - (insert "
\n") - (insert (if (functionp html-pre) (funcall html-pre) - (insert html-pre-real-contents))) - (insert "\n
\n"))) + (?d . ,date) (?e . ,email)))))) + ;; don't output an empty preamble DIV + (unless (and (functionp html-pre) + (equal html-pre-real-contents "")) + (insert "
\n") + (insert html-pre-real-contents) + (insert "\n
\n")))) ;; begin wrap around body (insert (format "\n
" @@ -1809,7 +1816,7 @@ PUB-DIR is set, use this as the publishing directory." (?d . ,date) (?c . ,creator-info) (?v . ,html-validation-link))))) ((functionp html-post) - (insert (funcall html-post))) + (funcall html-post)) ((eq html-post 'auto) ;; fall back on default postamble (when (plist-get opt-plist :time-stamp-file) -- 2.11.4.GIT