summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Vauban <sva@mygooglest.com>2011-09-29 21:49:11 +0200
committerBastien Guerry <bzg@altern.org>2011-10-29 13:28:28 +0200
commitd85e0e35ecc283621278480d546701ec012ac6ca (patch)
tree177612794c05bf9737501e54fe7b20e022878849
parent3267c69ccd17e8f43e6cee16f869f6622d46ae68 (diff)
downloadorg-mode-d85e0e35ecc283621278480d546701ec012ac6ca.tar.gz
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.
-rw-r--r--lisp/org-html.el23
1 files changed, 15 insertions, 8 deletions
diff --git a/lisp/org-html.el b/lisp/org-html.el
index 67ef545..7fa5e14 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 "<div id=\"" (nth 0 org-export-html-divs) "\">\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 "<div id=\"" (nth 0 org-export-html-divs) "\">\n")
+ (funcall html-pre)
+ (insert "\n</div>\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</div>\n")))
+ ;; don't output an empty preamble DIV
+ (unless (and (functionp html-pre)
+ (equal html-pre-real-contents ""))
+ (insert "<div id=\"" (nth 0 org-export-html-divs) "\">\n")
+ (insert html-pre-real-contents)
+ (insert "\n</div>\n"))))
;; begin wrap around body
(insert (format "\n<div id=\"%s\">"