From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sebastien Vauban" Subject: [patch] Don't output preamble DIV if its contents is empty Date: Thu, 29 Sep 2011 21:58:04 +0200 Message-ID: <80lit75df7.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org --=-=-= Content-Type: text/plain Hi, To be sure that CSS rules don't apply to missing contents, there's no need to output DIV preamble opening and closing tags if there is nothing in between. Best regards, Seb -- Sebastien Vauban --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-Don-t-output-DIV-preamble-tags-when-contents-is-empt.patch >From 9bb3959f8ca978e7486ba7bde11cd407a40e653b Mon Sep 17 00:00:00 2001 From: Sebastien Vauban Date: Thu, 29 Sep 2011 21:49:11 +0200 Subject: [PATCH 2/2] Don't output DIV preamble tags when contents is empty. --- lisp/org-html.el | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index fde563b..0139c16 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1337,23 +1337,30 @@ lang=\"%s\" xml:lang=\"%s\"> ;; 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
" -- 1.7.5.1 --=-=-=--