From d85e0e35ecc283621278480d546701ec012ac6ca Mon Sep 17 00:00:00 2001 From: Sebastien Vauban Date: Thu, 29 Sep 2011 21:49:11 +0200 Subject: [PATCH] Don't output DIV preamble tags when contents is empty. * org-html.el (org-export-as-html): Make sure the div for preamble is not inserted when the preamble is empty. --- lisp/org-html.el | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index 67ef545e2..7fa5e1445 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1342,23 +1342,30 @@ PUB-DIR is set, use this as the publishing directory." ;; insert html preamble (when (plist-get opt-plist :html-preamble) - (let ((html-pre (plist-get opt-plist :html-preamble))) - (insert "
\n") + (let ((html-pre (plist-get opt-plist :html-preamble)) + html-pre-real-contents) (cond ((stringp html-pre) - (insert - (format-spec html-pre `((?t . ,title) (?a . ,author) - (?d . ,date) (?e . ,email))))) + (setq html-pre-real-contents + (format-spec html-pre `((?t . ,title) (?a . ,author) + (?d . ,date) (?e . ,email))))) ((functionp html-pre) - (funcall html-pre)) + (insert "
\n") + (funcall html-pre) + (insert "\n
\n")) (t - (insert + (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)))))) - (insert "\n
\n"))) + ;; 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
"