emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
To: emacs-orgmode-mXXj517/zsQ@public.gmane.org
Subject: [patch] Re: HTML Postamble is inside Content DIV
Date: Thu, 21 Jul 2011 22:47:04 +0200	[thread overview]
Message-ID: <80r55j9x9z.fsf_-_@somewhere.org> (raw)
In-Reply-To: 4CE89955-F7C1-4708-A149-F60AB482E4DE@ulb.ac.be

[-- Attachment #1: Type: text/plain, Size: 1256 bytes --]

Hi Pierre, Bastien et al.,

Pierre de Buyl wrote:
> Le 8 juil. 11 à 09:36, Sebastien Vauban a écrit :
>>> Here is thus my proposition for a better div-structured HTML.
>>>
>>> There are only four parts required in the HTML for all the magic to work
>>> with the CSS:
>>>
>>> - The first part is a container div ("content", by default) that
>>> surrounds
>>>   everything.
>>>
>>> - Inside that are three more parts:
>>>   + a preamble (in a div, if the user wants it),
>>>   + a div "body" and
>>>   + a postamble (in a div, if the user wants it).
>>
>> Any objection for applying this patch?
>
> Not at all.

After off-line discussion with Bastien, here is the updated proposition --
and patch!

There is no global DIV anymore directly inside the body, as there is already
(in CSS) a virtual DIV called "#body"...

Inside the "body" tags, 3 DIV:

- "preamble" (useful for adding a static menu, outside of the "content" DIV)
- "content" (by default, see "org-export-html-content-div")
- "postamble"

Preamble and postamble DIV are only inserted if they're not void.

The "content" DIV (name free to be customized) will always be inserted.

Any comment or objection?

Best regards,
  Seb

-- 
Sebastien Vauban

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-html-new-structure.patch --]
[-- Type: text/x-patch, Size: 4200 bytes --]

diff --git a/lisp/org-html.el b/lisp/org-html.el
index 7bb8b61..8aff1c6 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -614,11 +614,6 @@ with a link to this URL."
 	  (const :tag "Keep internal css" nil)
 	  (string :tag "URL or local href")))
 
-(defcustom org-export-html-before-content-div ""
-  "Arbitrary HTML code placed before <div id=\"content\">."
-  :group 'org-export-html
-  :type 'string)
-
 (defcustom org-export-html-content-div "content"
   "The name of the container DIV that holds all the page contents."
   :group 'org-export-html
@@ -1300,8 +1295,6 @@ lang=\"%s\" xml:lang=\"%s\">
 </head>
 <body>
 %s
-<div id=\"%s\">
-%s
 "
 		 (format
 		  (or (and (stringp org-export-html-xml-declaration)
@@ -1317,8 +1310,6 @@ lang=\"%s\" xml:lang=\"%s\">
 		 date author description keywords
 		 style
 		 mathjax
-		 org-export-html-before-content-div
-		 org-export-html-content-div
 		 (if (or link-up link-home)
 		     (concat
 		      (format org-export-html-home/up-format
@@ -1330,6 +1321,7 @@ 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=\"preamble\">")
 	    (cond ((stringp html-pre)
 		   (insert
 		    (format-spec html-pre `((?t . ,title) (?a . ,author)
@@ -1343,8 +1335,13 @@ lang=\"%s\" xml:lang=\"%s\">
 				      org-export-html-preamble-format))
 			 (cadr (assoc "en" org-export-html-preamble-format)))
 		     `((?t . ,title) (?a . ,author)
-		       (?d . ,date) (?e . ,email)))))))))
+		       (?d . ,date) (?e . ,email))))))
+	    (insert "</div>\n")))
 
+	;; begin wrap around body
+	(insert (format "\n<div id=\"%s\">" org-export-html-content-div)))
+
+      ;; insert body
       (if (and org-export-with-toc (not body-only))
 	  (progn
 	    (push (format "<h%d>%s</h%d>\n"
@@ -1748,8 +1745,11 @@ lang=\"%s\" xml:lang=\"%s\">
 	(when bib
 	  (insert "\n" bib "\n")))
 
-      ;; export html postamble
       (unless body-only
+	;; end wrap around body
+	(insert "</div>\n")
+
+	;; export html postamble
 	(let ((html-post (plist-get opt-plist :html-postamble))
 	      (email
 	       (mapconcat (lambda(e)
@@ -1759,19 +1759,18 @@ lang=\"%s\" xml:lang=\"%s\">
 	      (creator-info
 	       (concat "Org version " org-version " with Emacs version "
 		       (number-to-string emacs-major-version))))
+
 	  (when (plist-get opt-plist :html-postamble)
+	    (insert "\n<div id=\"postamble\">")
 	    (cond ((stringp html-post)
-		   (insert "<div id=\"postamble\">\n")
 		   (insert (format-spec html-post
 					`((?a . ,author) (?e . ,email)
 					  (?d . ,date)   (?c . ,creator-info)
-					  (?v . ,html-validation-link))))
-		   (insert "</div>"))
+					  (?v . ,html-validation-link)))))
 		  ((functionp html-post)
 		   (funcall html-post))
 		  ((eq html-post 'auto)
 		   ;; fall back on default postamble
-		   (insert "<div id=\"postamble\">\n")
 		   (when (plist-get opt-plist :time-stamp-file)
 		     (insert "<p class=\"date\">" (nth 2 lang-words) ": " date "</p>\n"))
 		   (when (and (plist-get opt-plist :author-info) author)
@@ -1782,22 +1781,22 @@ lang=\"%s\" xml:lang=\"%s\">
 		     (insert "<p class=\"creator\">"
 			     (concat "Org version " org-version " with Emacs version "
 				     (number-to-string emacs-major-version) "</p>\n")))
-		   (insert html-validation-link "\n</div>"))
+		   (insert html-validation-link "\n"))
 		  (t
-		   (insert "<div id=\"postamble\">\n")
 		   (insert (format-spec
 			    (or (cadr (assoc (nth 0 lang-words)
 					     org-export-html-postamble-format))
 				(cadr (assoc "en" org-export-html-postamble-format)))
 			    `((?a . ,author) (?e . ,email)
 			      (?d . ,date)   (?c . ,creator-info)
-			      (?v . ,html-validation-link))))
-		   (insert "</div>"))))))
+			      (?v . ,html-validation-link))))))
+	    (insert "</div>")
+	    )))
 
       (if org-export-html-with-timestamp
 	  (insert org-export-html-html-helper-timestamp))
 
-      (unless body-only (insert "\n</div>\n</body>\n</html>\n"))
+      (unless body-only (insert "\n</body>\n</html>\n"))
 
       (unless (plist-get opt-plist :buffer-will-be-killed)
 	(normal-mode)

  reply	other threads:[~2011-07-21 20:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-29 22:15 HTML Postamble is inside Content DIV Sébastien Vauban
2011-04-30 18:41 ` Jonathan BISSON
2011-05-03 11:17   ` Sébastien Vauban
2011-05-31 18:56     ` Sebastien Vauban
2011-06-28 21:45       ` Sebastien Vauban
2011-06-29 13:26         ` Pierre de Buyl
2011-07-01 14:06           ` Sebastien Vauban
2011-07-06  6:49             ` Pierre de Buyl
2011-07-08  7:36               ` Sebastien Vauban
2011-07-08  9:28                 ` Pierre de Buyl
2011-07-21 20:47                   ` Sebastien Vauban [this message]
2011-07-21 23:35                     ` [patch] " Jambunathan K
2011-07-24 18:56                       ` Bastien
2011-07-23 17:11                     ` Bastien
2011-07-23 21:58                       ` Sebastien Vauban

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=80r55j9x9z.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).