summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2011-03-30 23:52:33 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2011-04-09 11:57:12 +0200
commit5efc6f5fc4cb3a81041d8ee39739827ddd034416 (patch)
treec8d37754ab11eef9a40d350d79924385fe721d69
parenta1458ba5ec4ce6349cac50cfddb9bd3632e6973d (diff)
downloadorg-mode-5efc6f5fc4cb3a81041d8ee39739827ddd034416.tar.gz
org-latex: fix footnotes wrt lists and links
* lisp/org-latex.el: pay attention to end of footnote. Before closing the command, ensure that list is properly closed or that last link is separated from the curly brace.
-rw-r--r--lisp/org-latex.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 5135e90..e7307ef 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -2412,12 +2412,15 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(replace-match (org-export-latex-protect-string
(concat "$^{" (match-string 1) "}$")))
(replace-match "")
- (let ((end (save-excursion
- (if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t)
- (match-beginning 0) (point-max)))))
- (setq footnote (concat (org-trim (buffer-substring (point) end))
- ; last } won't be part of a link or list.
- "\n"))
+ (let* ((end (save-excursion
+ (if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t)
+ (match-beginning 0) (point-max))))
+ (body (org-trim (buffer-substring (point) end))))
+ ;; Fix for footnotes ending on a link or a list.
+ (setq footnote
+ (concat body
+ (if (string-match "ORG-LIST-END-MARKER\\'" body)
+ "\n" " ")))
(delete-region (point) end))
(goto-char foot-beg)
(delete-region foot-beg foot-end)