mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-25 07:02:53 +00:00
Insert a customizable separator between footnotes
* lisp/org-docbook.el (org-export-docbook-footnote-separator): new variable (org-export-as-docbook): add a separator between footnotes. * lisp/org-html.el (org-export-html-footnote-separator): new variable. (org-export-as-html): add a separator between footnotes. * lisp/org-latex.el (org-export-latex-footnote-separator): new variable. (org-export-latex-preprocess): add a separator between footnotes.
This commit is contained in:
parent
ab9c52fd79
commit
789380330a
|
@ -148,6 +148,11 @@ avoid same set of footnote IDs being used multiple times."
|
||||||
:group 'org-export-docbook
|
:group 'org-export-docbook
|
||||||
:type 'string)
|
:type 'string)
|
||||||
|
|
||||||
|
(defcustom org-export-docbook-footnote-separator "<superscript>, </superscript>"
|
||||||
|
"Text used to separate footnotes."
|
||||||
|
:group 'org-export-docbook
|
||||||
|
:type 'string)
|
||||||
|
|
||||||
(defcustom org-export-docbook-emphasis-alist
|
(defcustom org-export-docbook-emphasis-alist
|
||||||
`(("*" "<emphasis role=\"bold\">" "</emphasis>")
|
`(("*" "<emphasis role=\"bold\">" "</emphasis>")
|
||||||
("/" "<emphasis>" "</emphasis>")
|
("/" "<emphasis>" "</emphasis>")
|
||||||
|
@ -942,6 +947,7 @@ publishing directory."
|
||||||
org-export-docbook-footnote-id-prefix num)
|
org-export-docbook-footnote-id-prefix num)
|
||||||
t t line))
|
t t line))
|
||||||
(setq line (replace-match
|
(setq line (replace-match
|
||||||
|
(concat
|
||||||
(format "%s<footnote xml:id=\"%s%s\"><para>%s</para></footnote>"
|
(format "%s<footnote xml:id=\"%s%s\"><para>%s</para></footnote>"
|
||||||
(match-string 1 line)
|
(match-string 1 line)
|
||||||
org-export-docbook-footnote-id-prefix
|
org-export-docbook-footnote-id-prefix
|
||||||
|
@ -950,6 +956,13 @@ publishing directory."
|
||||||
(save-match-data
|
(save-match-data
|
||||||
(org-docbook-expand (cdr footnote-def)))
|
(org-docbook-expand (cdr footnote-def)))
|
||||||
(format "FOOTNOTE DEFINITION NOT FOUND: %s" num)))
|
(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))
|
t t line))
|
||||||
(push (cons num 1) footref-seen))))))
|
(push (cons num 1) footref-seen))))))
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,12 @@ by the footnotes themselves."
|
||||||
:group 'org-export-html
|
:group 'org-export-html
|
||||||
:type 'string)
|
:type 'string)
|
||||||
|
|
||||||
|
|
||||||
|
(defcustom org-export-html-footnote-separator "<sup>, </sup>"
|
||||||
|
"Text used to separate footnotes."
|
||||||
|
:group 'org-export-html
|
||||||
|
:type 'string)
|
||||||
|
|
||||||
(defcustom org-export-html-coding-system nil
|
(defcustom org-export-html-coding-system nil
|
||||||
"Coding system for HTML export, defaults to `buffer-file-coding-system'."
|
"Coding system for HTML export, defaults to `buffer-file-coding-system'."
|
||||||
:group 'org-export-html
|
:group 'org-export-html
|
||||||
|
@ -1587,11 +1593,19 @@ lang=\"%s\" xml:lang=\"%s\">
|
||||||
(push (cons n 1) footref-seen))
|
(push (cons n 1) footref-seen))
|
||||||
(setq line
|
(setq line
|
||||||
(replace-match
|
(replace-match
|
||||||
|
(concat
|
||||||
(format
|
(format
|
||||||
(concat "%s"
|
(concat "%s"
|
||||||
(format org-export-html-footnote-format
|
(format org-export-html-footnote-format
|
||||||
"<a class=\"footref\" name=\"fnr.%s%s\" href=\"#fn.%s\">%s</a>"))
|
(concat "<a class=\"footref\" name=\"fnr.%s%s\" href=\"#fn.%s\">%s</a>")))
|
||||||
(or (match-string 1 line) "") n extra n n)
|
(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))))))
|
t t line))))))
|
||||||
|
|
||||||
(cond
|
(cond
|
||||||
|
|
|
@ -311,6 +311,11 @@ will be filled with the link, the second with its description."
|
||||||
:group 'org-export-latex
|
:group 'org-export-latex
|
||||||
:type 'string)
|
: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
|
(defcustom org-export-latex-tables-verbatim nil
|
||||||
"When non-nil, tables are exported verbatim."
|
"When non-nil, tables are exported verbatim."
|
||||||
:group 'org-export-latex
|
: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 converting to LaTeX, replace footnotes.
|
||||||
(when (plist-get opt-plist :footnotes)
|
(when (plist-get opt-plist :footnotes)
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(let (ref mark-max)
|
(let (ref)
|
||||||
(while (setq ref (org-footnote-get-next-reference))
|
(while (setq ref (org-footnote-get-next-reference))
|
||||||
(let* ((beg (nth 1 ref))
|
(let* ((beg (nth 1 ref))
|
||||||
(lbl (string-to-number (car 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)
|
(push lbl org-export-latex-footmark-seen)
|
||||||
(concat (org-export-latex-protect-string "\\footnote{")
|
(concat (org-export-latex-protect-string "\\footnote{")
|
||||||
def
|
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)
|
(when (org-on-heading-p)
|
||||||
(setq fnote
|
(setq fnote
|
||||||
(concat (org-export-latex-protect-string "\\protect") 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.
|
;; `org-footnote-get-next-reference' would then skip it.
|
||||||
(goto-char beg)
|
(goto-char beg)
|
||||||
(delete-region beg (nth 2 ref))
|
(delete-region beg (nth 2 ref))
|
||||||
(save-excursion (insert fnote)))))))
|
(save-excursion (insert fnote sep)))))))
|
||||||
|
|
||||||
;; Remove footnote section tag for LaTeX
|
;; Remove footnote section tag for LaTeX
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
|
|
Loading…
Reference in a new issue