ox-html: Fix consistency between footnote definitions

* lisp/ox-html.el (org-html-footnote-section): Wrap inline inline
  footnote definitions within a paragraph.

Reported-by: Matthias Paulmier <matthias.paulmier@etu.u-bordeaux.fr>
<http://lists.gnu.org/r/emacs-orgmode/2018-10/msg00006.html>
This commit is contained in:
Nicolas Goaziou 2018-10-03 15:26:14 +02:00
parent 0122746f5b
commit 524be7cdb1
1 changed files with 26 additions and 21 deletions

View File

@ -1784,33 +1784,38 @@ Replaces invalid characters with \"_\"."
(defun org-html-footnote-section (info) (defun org-html-footnote-section (info)
"Format the footnote section. "Format the footnote section.
INFO is a plist used as a communication channel." INFO is a plist used as a communication channel."
(let* ((fn-alist (org-export-collect-footnote-definitions info)) (pcase (org-export-collect-footnote-definitions info)
(fn-alist (`nil nil)
(cl-loop for (n _type raw) in fn-alist collect (definitions
(cons n (if (eq (org-element-type raw) 'org-data)
(org-trim (org-export-data raw info))
(format "<div class=\"footpara\">%s</div>"
(org-trim (org-export-data raw info))))))))
(when fn-alist
(format (format
(plist-get info :html-footnotes-section) (plist-get info :html-footnotes-section)
(org-html--translate "Footnotes" info) (org-html--translate "Footnotes" info)
(format (format
"\n%s\n" "\n%s\n"
(mapconcat (mapconcat
(lambda (fn) (lambda (definition)
(let ((n (car fn)) (def (cdr fn))) (pcase definition
(format (`(,n ,_ ,def)
"<div class=\"footdef\">%s %s</div>\n" ;; `org-export-collect-footnote-definitions' can return
(format ;; two kinds of footnote definitions: inline and blocks.
(plist-get info :html-footnote-format) ;; Since this should not make any difference in the HTML
(org-html--anchor ;; output, we wrap the inline definitions within
(format "fn.%d" n) ;; a "footpara" class paragraph.
n (let ((inline? (not (org-element-map def org-element-all-elements
(format " class=\"footnum\" href=\"#fnr.%d\"" n) #'identity nil t)))
info)) (anchor (org-html--anchor
def))) (format "fn.%d" n)
fn-alist n
(format " class=\"footnum\" href=\"#fnr.%d\"" n)
info))
(contents (org-trim (org-export-data def info))))
(format "<div class=\"footdef\">%s %s</div>\n"
(format (plist-get info :html-footnote-format) anchor)
(format "<div class=\"footpara\">%s</div>"
(if (not inline?) contents
(format "<p class=\"footpara\">%s</p>"
contents))))))))
definitions
"\n")))))) "\n"))))))