emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals-release/org 6dbd132: ox-texinfo: Fix footnotes ending o


From: ELPA Syncer
Subject: [elpa] externals-release/org 6dbd132: ox-texinfo: Fix footnotes ending on a special environment
Date: Mon, 12 Apr 2021 18:57:07 -0400 (EDT)

branch: externals-release/org
commit 6dbd132e62c0305ce021d550ea66268e0497f80d
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Commit: Nicolas Goaziou <mail@nicolasgoaziou.fr>

    ox-texinfo: Fix footnotes ending on a special environment
    
    * lisp/ox-texinfo.el (org-texinfo-footnote-reference): Prevent
    a footnote from ending on an "@end" line.
    
    Reported-by: Ramesh Nedunchezian <rameshnedunchezian@outlook.com>
    <http://lists.gnu.org/r/emacs-orgmode/2021-04/msg00228.html>
---
 lisp/ox-texinfo.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index 52c8180..ece0ef4 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -846,9 +846,17 @@ CONTENTS is nil.  INFO is a plist holding contextual 
information."
 
 FOOTNOTE is the footnote to define.  CONTENTS is nil.  INFO is a
 plist holding contextual information."
-  (let ((def (org-export-get-footnote-definition footnote info)))
+  (let* ((contents (org-export-get-footnote-definition footnote info))
+         (data (org-export-data contents info)))
     (format "@footnote{%s}"
-           (org-trim (org-export-data def info)))))
+            ;; It is invalid to close a footnote on a line starting
+            ;; with "@end".  As a safety net, we leave a newline
+            ;; character before the closing brace.  However, when the
+            ;; footnote ends with a paragraph, it is visually pleasing
+            ;; to move the brace right after its end.
+            (if (eq 'paragraph (org-element-type (org-last contents)))
+                (org-trim data)
+              data))))
 
 ;;;; Headline
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]