From c9cd22e861d3c0e01a4b7e634bca657d7a731655 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 3 Nov 2008 21:05:12 +0100 Subject: [PATCH] Collect footnotes in HTML export. All footnotes are now collected and put into a separate
at the end of the HTML document, but before the footer. --- lisp/ChangeLog | 1 + lisp/org-exp.el | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 675c41b81..a33e04f2f 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,7 @@ * org-exp.el (org-export-as-html): Fully process link descriptions. (org-export-html-format-desc): New function. + (org-export-as-html): Collect footnotes into the correct basket. * org-agenda.el (org-agenda-remove-marked-text): Bind variable BEG. diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 453cd1fe4..44c7beed2 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2779,6 +2779,7 @@ in a window. A non-interactive call will only return the buffer." rtn))) (defvar html-table-tag nil) ; dynamically scoped into this. +(defvar org-par-open nil) ;;;###autoload (defun org-export-as-html (arg &optional hidden ext-plist to-buffer body-only pub-dir) @@ -2930,6 +2931,7 @@ PUB-DIR is set, use this as the publishing directory." ind item-type starter didclose rpl path attr desc descp desc1 desc2 link snumber fnc item-tag + footnotes ) (let ((inhibit-read-only t)) @@ -3445,9 +3447,9 @@ lang=\"%s\" xml:lang=\"%s\"> (when (string-match "^[ \t]*\\[\\([0-9]+\\)\\]" line) (org-close-par-maybe) (let ((n (match-string 1 line))) - (setq line (replace-match - (format "

%s" n n n) t t line)) - (setq line (concat line "

"))))) + (setq org-par-open t + line (replace-match + (format "

%s" n n n) t t line))))) ;; Check if the line break needs to be conserved (cond @@ -3476,6 +3478,16 @@ lang=\"%s\" xml:lang=\"%s\"> ;; the

to close the last text-... div. (insert "\n") + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "

[^\000]*?\\(

\\|\\'\\)" nil t) + (push (match-string 0) footnotes) + (replace-match "" t t))) + (when footnotes + (insert "
\n" + (mapconcat 'identity (nreverse footnotes) "\n") + "\n
\n")) + (unless body-only (when (plist-get opt-plist :auto-postamble) (insert "
") @@ -4083,7 +4095,6 @@ stacked delimiters is N. Escaping delimiters is not possible." (setq s (1+ s)))) string)) -(defvar org-par-open nil) (defun org-open-par () "Insert

, but first close previous paragraph if any." (org-close-par-maybe)