summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2011-05-26 20:35:46 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2011-06-29 12:00:43 +0200
commit30944f228e91ed060d03e65a5010d97629ec4d5f (patch)
tree9807afc546774794a11085f4ee63dec0478f2b98
parent6eee91a1171b70029ec290c18a32180cd1680e9d (diff)
downloadorg-mode-30944f228e91ed060d03e65a5010d97629ec4d5f.tar.gz
Add properties to footnotes during export
* lisp/org-footnote.el (org-footnote-normalize): add `org-footnote' property to footnote markers when preparing for exportation. * lisp/org-html.el (org-export-as-html): read new property to decide when to export a footnote. * lisp/org-docbook.el (org-export-as-docbook): read new property to decide when to export a footnote. * lisp/org-latex.el (org-export-latex-preprocess): ensure footnote at column 0 cannot end a list containing it by adding `original-indentation' property to it.
-rw-r--r--lisp/org-docbook.el5
-rw-r--r--lisp/org-footnote.el7
-rw-r--r--lisp/org-html.el5
-rw-r--r--lisp/org-latex.el7
4 files changed, 19 insertions, 5 deletions
diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el
index b006b74..087817d 100644
--- a/lisp/org-docbook.el
+++ b/lisp/org-docbook.el
@@ -936,7 +936,10 @@ publishing directory."
(when org-export-with-footnotes
(setq start 0)
(while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line start)
- (if (get-text-property (match-beginning 2) 'org-protected line)
+ ;; Discard protected matches not clearly identified as
+ ;; footnote markers.
+ (if (or (get-text-property (match-beginning 2) 'org-protected line)
+ (not (get-text-property (match-beginning 2) 'org-footnote line)))
(setq start (match-end 2))
(let* ((num (match-string 2 line))
(footnote-def (assoc num footnote-list)))
diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index 586e812..075f086 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -532,11 +532,16 @@ Additional note on `org-footnote-insert-pos-for-preprocessor':
;; Replace footnote reference with [MARKER]. Maybe fill
;; paragraph once done. If SORT-ONLY is non-nil, only move
;; to the end of reference found to avoid matching it twice.
+ ;; If PRE-PROCESS-P isn't nil, also add `org-footnote'
+ ;; property to it, so it can be easily recognized by
+ ;; exporters.
(if sort-only
(goto-char (nth 2 ref))
(delete-region (nth 1 ref) (nth 2 ref))
(goto-char (nth 1 ref))
- (insert (format "[%d]" marker))
+ (let ((new-ref (format "[%d]" marker)))
+ (when pre-process-p (org-add-props new-ref '(org-footnote t)))
+ (insert new-ref))
(and inlinep
org-footnote-fill-after-inline-note-extraction
(org-fill-paragraph)))
diff --git a/lisp/org-html.el b/lisp/org-html.el
index 82d21eb..80e0738 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -1582,7 +1582,10 @@ lang=\"%s\" xml:lang=\"%s\">
(when org-export-with-footnotes
(setq start 0)
(while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line start)
- (if (get-text-property (match-beginning 2) 'org-protected line)
+ ;; Discard protected matches not clearly identified as
+ ;; footnote markers.
+ (if (or (get-text-property (match-beginning 2) 'org-protected line)
+ (not (get-text-property (match-beginning 2) 'org-footnote line)))
(setq start (match-end 2))
(let ((n (match-string 2 line)) extra a)
(if (setq a (assoc n footref-seen))
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index be686be..39b4440 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -2456,8 +2456,11 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(and next (= (nth 1 next) (nth 2 ref)))))
org-export-latex-footnote-separator ""))))
(when (org-on-heading-p)
- (setq fnote
- (concat (org-export-latex-protect-string "\\protect") fnote)))
+ (setq fnote (concat (org-export-latex-protect-string"\\protect")
+ fnote)))
+ ;; Ensure a footnote at column 0 cannot end a list
+ ;; containing it.
+ (put-text-property 0 (length fnote) 'original-indentation 1000 fnote)
;; Replace footnote reference with FNOTE and, maybe, SEP.
;; `save-excursion' is required if there are two footnotes
;; in a row. In that case, point would be left at the