diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el index f3cb48747..b006b74cc 100644 --- a/lisp/org-docbook.el +++ b/lisp/org-docbook.el @@ -148,6 +148,11 @@ avoid same set of footnote IDs being used multiple times." :group 'org-export-docbook :type 'string) +(defcustom org-export-docbook-footnote-separator ", " + "Text used to separate footnotes." + :group 'org-export-docbook + :type 'string) + (defcustom org-export-docbook-emphasis-alist `(("*" "" "") ("/" "" "") @@ -942,14 +947,22 @@ publishing directory." org-export-docbook-footnote-id-prefix num) t t line)) (setq line (replace-match - (format "%s%s" - (match-string 1 line) - org-export-docbook-footnote-id-prefix - num - (if footnote-def - (save-match-data - (org-docbook-expand (cdr footnote-def))) - (format "FOOTNOTE DEFINITION NOT FOUND: %s" num))) + (concat + (format "%s%s" + (match-string 1 line) + org-export-docbook-footnote-id-prefix + num + (if footnote-def + (save-match-data + (org-docbook-expand (cdr footnote-def))) + (format "FOOTNOTE DEFINITION NOT FOUND: %s" num))) + ;; If another footnote is following the + ;; current one, add a separator. + (if (save-match-data + (string-match "\\`\\[[0-9]+\\]" + (substring line (match-end 0)))) + org-export-docbook-footnote-separator + "")) t t line)) (push (cons num 1) footref-seen)))))) diff --git a/lisp/org-html.el b/lisp/org-html.el index 7627fb224..82d21ebde 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -60,6 +60,12 @@ by the footnotes themselves." :group 'org-export-html :type 'string) + +(defcustom org-export-html-footnote-separator ", " + "Text used to separate footnotes." + :group 'org-export-html + :type 'string) + (defcustom org-export-html-coding-system nil "Coding system for HTML export, defaults to `buffer-file-coding-system'." :group 'org-export-html @@ -1587,11 +1593,19 @@ lang=\"%s\" xml:lang=\"%s\"> (push (cons n 1) footref-seen)) (setq line (replace-match - (format - (concat "%s" - (format org-export-html-footnote-format - "%s")) - (or (match-string 1 line) "") n extra n n) + (concat + (format + (concat "%s" + (format org-export-html-footnote-format + (concat "%s"))) + (or (match-string 1 line) "") n extra n n) + ;; If another footnote is following the + ;; current one, add a separator. + (if (save-match-data + (string-match "\\`\\[[0-9]+\\]" + (substring line (match-end 0)))) + org-export-html-footnote-separator + "")) t t line)))))) (cond diff --git a/lisp/org-latex.el b/lisp/org-latex.el index f68879a50..d6b76ea8d 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -311,6 +311,11 @@ will be filled with the link, the second with its description." :group 'org-export-latex :type 'string) +(defcustom org-export-latex-footnote-separator "\\textsuperscript{,}\\," + "Text used to separate footnotes." + :group 'org-export-latex + :type 'string) + (defcustom org-export-latex-tables-verbatim nil "When non-nil, tables are exported verbatim." :group 'org-export-latex @@ -2420,7 +2425,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." ;; When converting to LaTeX, replace footnotes. (when (plist-get opt-plist :footnotes) (goto-char (point-min)) - (let (ref mark-max) + (let (ref) (while (setq ref (org-footnote-get-next-reference)) (let* ((beg (nth 1 ref)) (lbl (string-to-number (car ref))) @@ -2442,7 +2447,12 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (push lbl org-export-latex-footmark-seen) (concat (org-export-latex-protect-string "\\footnote{") def - (org-export-latex-protect-string "}"))))) + (org-export-latex-protect-string "}")))) + (sep (org-export-latex-protect-string + (if (save-excursion (goto-char (1- (nth 2 ref))) + (let ((next (org-footnote-get-next-reference))) + (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))) @@ -2453,7 +2463,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." ;; `org-footnote-get-next-reference' would then skip it. (goto-char beg) (delete-region beg (nth 2 ref)) - (save-excursion (insert fnote))))))) + (save-excursion (insert fnote sep))))))) ;; Remove footnote section tag for LaTeX (goto-char (point-min))