diff options
author | Bastien Guerry <bzg@altern.org> | 2011-07-27 19:23:24 +0200 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2011-07-27 19:23:24 +0200 |
commit | 8d25fdc7e124a3c3753afff003575bce28071d89 (patch) | |
tree | 3a2fef7d2133cdbe62e9c226d9cd7fe9b9adad60 | |
parent | e7eb56f39b5b843bc1487bb49c58e99e51c81fc1 (diff) | |
download | org-mode-8d25fdc7e124a3c3753afff003575bce28071d89.tar.gz |
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.
-rw-r--r-- | lisp/org-html.el | 170 |
1 files changed, 90 insertions, 80 deletions
diff --git a/lisp/org-html.el b/lisp/org-html.el index cb04067..5b5202f 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -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,91 +1368,95 @@ lang=\"%s\" xml:lang=\"%s\"> (push "<div id=\"text-table-of-contents\">\n" thetoc) (push "<ul>\n<li>" thetoc) (setq lines - (mapcar #'(lambda (line) - (if (and (string-match org-todo-line-regexp line) - (not (get-text-property 0 'org-protected line))) - ;; This is a headline - (progn - (setq have-headings t) - (setq level (- (match-end 1) (match-beginning 1) - level-offset) - level (org-tr-level level) - txt (save-match-data - (org-html-expand - (org-export-cleanup-toc-line - (match-string 3 line)))) - todo - (or (and org-export-mark-todo-in-toc - (match-beginning 2) - (not (member (match-string 2 line) - org-done-keywords))) + (mapcar + #'(lambda (line) + (if (and (string-match org-todo-line-regexp line) + (not (get-text-property 0 'org-protected line))) + ;; This is a headline + (progn + (setq have-headings t) + (setq level (- (match-end 1) (match-beginning 1) + level-offset) + level (org-tr-level level) + txt (save-match-data + (org-html-expand + (org-export-cleanup-toc-line + (match-string 3 line)))) + todo + (or (and org-export-mark-todo-in-toc + (match-beginning 2) + (not (member (match-string 2 line) + org-done-keywords))) ; TODO, not DONE - (and org-export-mark-todo-in-toc - (= level umax-toc) - (org-search-todo-below - line lines level)))) - (if (string-match - (org-re "[ \t]+:\\([[:alnum:]_@:]+\\):[ \t]*$") txt) - (setq txt (replace-match " <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)) - (if (and num (if (integerp num) - (>= num level) - num)) - (setq txt (concat snumber " " txt))) - (if (<= level (max umax umax-toc)) - (setq head-count (+ head-count 1))) - (if (<= level umax-toc) + (and org-export-mark-todo-in-toc + (= level umax-toc) + (org-search-todo-below + line lines level)))) + (if (string-match + (org-re "[ \t]+:\\([[:alnum:]_@:]+\\):[ \t]*$") txt) + (setq txt (replace-match + " <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)) + (if (and num (if (integerp num) + (>= num level) + num)) + (setq txt (concat snumber " " txt))) + (if (<= level (max umax umax-toc)) + (setq head-count (+ head-count 1))) + (if (<= level umax-toc) + (progn + (if (> level org-last-level) (progn - (if (> level org-last-level) - (progn - (setq cnt (- level org-last-level)) - (while (>= (setq cnt (1- cnt)) 0) - (push "\n<ul>\n<li>" thetoc)) - (push "\n" thetoc))) - (if (< level org-last-level) - (progn - (setq cnt (- org-last-level level)) - (while (>= (setq cnt (1- cnt)) 0) - (push "</li>\n</ul>" thetoc)) - (push "\n" thetoc))) - ;; Check for targets - (while (string-match org-any-target-regexp line) - (setq line (replace-match - (concat "@<span class=\"target\">" (match-string 1 line) "@</span> ") - t t line))) - (while (string-match "<\\(<\\)+\\|>\\(>\\)+" 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))) - (push - (format - (if todo - "</li>\n<li><a href=\"#%s\"><span class=\"todo\">%s</span></a>" - "</li>\n<li><a href=\"#%s\">%s</a>") - href txt) thetoc) - - (setq org-last-level level)) - ))) - line) - lines)) + (setq cnt (- level org-last-level)) + (while (>= (setq cnt (1- cnt)) 0) + (push "\n<ul>\n<li>" thetoc)) + (push "\n" thetoc))) + (if (< level org-last-level) + (progn + (setq cnt (- org-last-level level)) + (while (>= (setq cnt (1- cnt)) 0) + (push "</li>\n</ul>" thetoc)) + (push "\n" thetoc))) + ;; Check for targets + (while (string-match org-any-target-regexp line) + (setq line (replace-match + (concat "@<span class=\"target\">" + (match-string 1 line) "@</span> ") + t t line))) + (while (string-match "<\\(<\\)+\\|>\\(>\\)+" 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))) + (push + (format + (if todo + "</li>\n<li><a href=\"#%s\"><span class=\"todo\">%s</span></a>" + "</li>\n<li><a href=\"#%s\">%s</a>") + href txt) thetoc) + + (setq org-last-level level))))) + line) + lines)) (while (> org-last-level (1- org-min-level)) (setq org-last-level (1- org-last-level)) (push "</li>\n</ul>\n" thetoc)) (push "</div>\n" thetoc) (setq thetoc (if have-headings (nreverse thetoc) nil)))) - + (setq head-count 0) (org-init-section-numbers) - + (org-open-par) - + (while (setq line (pop lines) origline line) (catch 'nextline - + ;; end of quote section? (when (and inquote (string-match org-outline-regexp-bol line)) (insert "</pre>\n") |