From e688c534a835dc1dda43246e3575797a6e04d732 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 3 Mar 2009 10:46:55 +0100 Subject: [PATCH] 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. --- lisp/ChangeLog | 1 + lisp/org-exp.el | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 498a850b7..bb13620a5 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -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'. diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 80e96dfeb..f3b5054c1 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -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 "
") + (insert "
\n") (when (and org-export-author-info author) (insert "

" (nth 1 lang-words) ": " author "\n") @@ -4170,6 +4173,22 @@ lang=\"%s\" xml:lang=\"%s\"> (if caption (concat "\n

" caption "

") "") (if org-par-open "\n

" "")))))) +(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]*

" nil t) + (setq cnt (+ cnt (if (string= (match-string 0) "") (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)