From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sebastien Vauban" Subject: [patch] Re: HTML Postamble is inside Content DIV Date: Thu, 21 Jul 2011 22:47:04 +0200 Message-ID: <80r55j9x9z.fsf_-_@somewhere.org> References: <80mxj8g0wl.fsf@somewhere.org> <80ei4gdoe7.fsf@somewhere.org> <801uzeu2b6.fsf@somewhere.org> <808vslr5ox.fsf@somewhere.org> <0903D18D-AB13-430D-81EF-93421BDB7D01@ulb.ac.be> <80y60iumbh.fsf@somewhere.org> <8039ih6x7f.fsf@somewhere.org> <4CE89955-F7C1-4708-A149-F60AB482E4DE@ulb.ac.be> 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; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Pierre, Bastien et al., Pierre de Buyl wrote: > Le 8 juil. 11 =C3=A0 09:36, Sebastien Vauban a =C3=A9crit : >>> 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 --=20 Sebastien Vauban --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=org-html-new-structure.patch 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
." - :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\"> %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 "
") (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 "
\n"))) + ;; begin wrap around body + (insert (format "\n
" org-export-html-content-div))) + + ;; insert body (if (and org-export-with-toc (not body-only)) (progn (push (format "%s\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 "
\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
") (cond ((stringp html-post) - (insert "
\n") (insert (format-spec html-post `((?a . ,author) (?e . ,email) (?d . ,date) (?c . ,creator-info) - (?v . ,html-validation-link)))) - (insert "
")) + (?v . ,html-validation-link))))) ((functionp html-post) (funcall html-post)) ((eq html-post 'auto) ;; fall back on default postamble - (insert "
\n") (when (plist-get opt-plist :time-stamp-file) (insert "

" (nth 2 lang-words) ": " date "

\n")) (when (and (plist-get opt-plist :author-info) author) @@ -1782,22 +1781,22 @@ lang=\"%s\" xml:lang=\"%s\"> (insert "

" (concat "Org version " org-version " with Emacs version " (number-to-string emacs-major-version) "

\n"))) - (insert html-validation-link "\n
")) + (insert html-validation-link "\n")) (t - (insert "
\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 "
")))))) + (?v . ,html-validation-link)))))) + (insert "
") + ))) (if org-export-html-with-timestamp (insert org-export-html-html-helper-timestamp)) - (unless body-only (insert "\n
\n\n\n")) + (unless body-only (insert "\n\n\n")) (unless (plist-get opt-plist :buffer-will-be-killed) (normal-mode) --=-=-=--