org-html: put the title back in the content div.

This is needed for the HTML file to interact correctly with
org-info.js.  On the long term, the title should be part of
the preamble, but this requires work on org-info.js.

* org-html.el (org-export-html-preamble-format): New default
for the HTML preamble: don't include the title.  Also improve
the docstring.
(org-export-html-postamble-format): Improve the docstring.
(org-export-as-html): Add the title within the "content" div.
This is necessary for interaction with the org-info.js script.
This commit is contained in:
Bastien Guerry 2011-07-27 19:23:24 +02:00
parent e7eb56f39b
commit 8d25fdc7e1
1 changed files with 90 additions and 80 deletions

View File

@ -369,11 +369,13 @@ precedence over this variable."
(string :tag "Custom formatting string")
(function :tag "Function (must return a string)")))
(defcustom org-export-html-preamble-format
'(("en" "<h1 class=\"title\">%t</h1>"))
(defcustom org-export-html-preamble-format '(("en" ""))
"The format for the HTML preamble.
%t stands for the title.
%a stands for the author's name.
%e stands for the author's email.
%d stands for the date.
If you need to use a \"%\" character, you need to escape it
like that: \"%%\"."
@ -409,10 +411,10 @@ precedence over this variable."
"))
"The format for the HTML postamble.
%a stands for the author.
%e stands for the email(s).
%a stands for the author's name.
%e stands for the author's email.
%d stands for the date.
%c will be replaced by information about Org/Emacs.
%c will be replaced by information about Org/Emacs versions.
%v will be replaced by `org-export-html-validation-link'.
If you need to use a \"%\" character, you need to escape it
@ -1348,8 +1350,12 @@ lang=\"%s\" xml:lang=\"%s\">
;; begin wrap around body
(insert (format "\n<div id=\"%s\">"
(or org-export-html-content-div ; <= FIXME obsolete since 7.7
(nth 1 org-export-html-divs)))))
;; FIXME org-export-html-content-div is obsolete since 7.7
(or org-export-html-content-div
(nth 1 org-export-html-divs)))
;; FIXME this should go in the preamble but is here so
;; that org-infojs can still find it
"\n<h1 class=\"title\">" title "</h1>\n"))
;; insert body
(if (and org-export-with-toc (not body-only))
@ -1362,7 +1368,8 @@ lang=\"%s\" xml:lang=\"%s\">
(push "<div id=\"text-table-of-contents\">\n" thetoc)
(push "<ul>\n<li>" thetoc)
(setq lines
(mapcar #'(lambda (line)
(mapcar
#'(lambda (line)
(if (and (string-match org-todo-line-regexp line)
(not (get-text-property 0 'org-protected line)))
;; This is a headline
@ -1387,7 +1394,8 @@ lang=\"%s\" xml:lang=\"%s\">
line lines level))))
(if (string-match
(org-re "[ \t]+:\\([[:alnum:]_@:]+\\):[ \t]*$") txt)
(setq txt (replace-match "&nbsp;&nbsp;&nbsp;<span class=\"tag\"> \\1</span>" t nil txt)))
(setq txt (replace-match
"&nbsp;&nbsp;&nbsp;<span class=\"tag\"> \\1</span>" t nil txt)))
(if (string-match quote-re0 txt)
(setq txt (replace-match "" t t txt)))
(setq snumber (org-section-number level))
@ -1414,14 +1422,17 @@ lang=\"%s\" xml:lang=\"%s\">
;; Check for targets
(while (string-match org-any-target-regexp line)
(setq line (replace-match
(concat "@<span class=\"target\">" (match-string 1 line) "@</span> ")
(concat "@<span class=\"target\">"
(match-string 1 line) "@</span> ")
t t line)))
(while (string-match "&lt;\\(&lt;\\)+\\|&gt;\\(&gt;\\)+" txt)
(setq txt (replace-match "" t t txt)))
(setq href
(replace-regexp-in-string
"\\." "-" (format "sec-%s" snumber)))
(setq href (org-solidify-link-text (or (cdr (assoc href org-export-preferred-target-alist)) href)))
(setq href (org-solidify-link-text
(or (cdr (assoc href
org-export-preferred-target-alist)) href)))
(push
(format
(if todo
@ -1429,8 +1440,7 @@ lang=\"%s\" xml:lang=\"%s\">
"</li>\n<li><a href=\"#%s\">%s</a>")
href txt) thetoc)
(setq org-last-level level))
)))
(setq org-last-level level)))))
line)
lines))
(while (> org-last-level (1- org-min-level))