From: "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
To: emacs-orgmode-mXXj517/zsQ@public.gmane.org
Subject: [patch] Don't output preamble DIV if its contents is empty
Date: Thu, 29 Sep 2011 21:58:04 +0200 [thread overview]
Message-ID: <80lit75df7.fsf@somewhere.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 203 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-Don-t-output-DIV-preamble-tags-when-contents-is-empt.patch --]
[-- Type: text/x-patch, Size: 1951 bytes --]
From 9bb3959f8ca978e7486ba7bde11cd407a40e653b Mon Sep 17 00:00:00 2001
From: Sebastien Vauban <sva-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
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 "<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\">"
--
1.7.5.1
next reply other threads:[~2011-09-29 19:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-29 19:58 Sebastien Vauban [this message]
2011-10-09 11:24 ` [patch] Don't output preamble DIV if its contents is empty Carsten Dominik
2011-10-09 18:34 ` Sebastien Vauban
2011-10-29 11:31 ` Bastien
2011-10-29 19:28 ` Sebastien Vauban
2011-10-30 0:12 ` Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=80lit75df7.fsf@somewhere.org \
--to=wxhgmqzgwmuf-genee64ty+gs+fvcfc7uqw@public.gmane.org \
--cc=emacs-orgmode-mXXj517/zsQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).