0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-25 22:32:51 +00:00

HTML export: Find bibliography and move to to after the last section.

Before, the bibliography will exist inside the outline structure, as
part of the last section.  This commit adds code to find it, cut it
out, and move it to a better location.
This commit is contained in:
Carsten Dominik 2009-03-03 10:46:55 +01:00
parent a68eb4b1e6
commit e688c534a8
2 changed files with 21 additions and 1 deletions

View file

@ -2,6 +2,7 @@
* org-exp.el (org-export-as-html): Add a "content" div around the
entire content of the body tag.
(org-export-html-get-bibliography): New function.
* org.el (org-match-sparse-tree): Renamed from
`org-tags-sparse-tree'.

View file

@ -4047,9 +4047,12 @@ lang=\"%s\" xml:lang=\"%s\">
(or (nth 4 lang-words) "Footnotes")
(mapconcat 'identity (nreverse footnotes) "\n"))
"\n"))
(let ((bib (org-export-html-get-bibliography)))
(when bib
(insert "\n" bib "\n")))
(unless body-only
(when (plist-get opt-plist :auto-postamble)
(insert "<div id=\"postamble\">")
(insert "<div id=\"postamble\">\n")
(when (and org-export-author-info author)
(insert "<p class=\"author\"> "
(nth 1 lang-words) ": " author "\n")
@ -4170,6 +4173,22 @@ lang=\"%s\" xml:lang=\"%s\">
(if caption (concat "\n<p>" caption "</p>") "")
(if org-par-open "\n<p>" ""))))))
(defun org-export-html-get-bibliography ()
"Find bibliography, cut it out and return it."
(catch 'exit
(let (beg end (cnt 1))
(save-excursion
(goto-char (point-min))
(when (re-search-forward "^[ \t]*<div \\(id\\|class\\)=\"bibliography\"" nil t)
(setq beg (match-beginning 0))
(while (re-search-forward "</?div\\>" nil t)
(setq cnt (+ cnt (if (string= (match-string 0) "<div") +1 -1)))
(when (= cnt 0)
(and (looking-at ">") (forward-char 1))
(setq bib (buffer-substring beg (point)))
(delete-region beg (point))
(throw 'exit bib))))
nil))))
(defvar org-table-colgroup-info nil)
(defun org-format-table-ascii (lines)