1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-29 07:58:21 +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:
Nicolas Goaziou 2011-05-14 10:26:40 +02:00
parent ab9c52fd79
commit 789380330a
3 changed files with 53 additions and 16 deletions

View File

@ -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 "<superscript>, </superscript>"
"Text used to separate footnotes."
:group 'org-export-docbook
:type 'string)
(defcustom org-export-docbook-emphasis-alist
`(("*" "<emphasis role=\"bold\">" "</emphasis>")
("/" "<emphasis>" "</emphasis>")
@ -942,14 +947,22 @@ publishing directory."
org-export-docbook-footnote-id-prefix num)
t t line))
(setq line (replace-match
(format "%s<footnote xml:id=\"%s%s\"><para>%s</para></footnote>"
(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<footnote xml:id=\"%s%s\"><para>%s</para></footnote>"
(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))))))

View File

@ -60,6 +60,12 @@ by the footnotes themselves."
:group 'org-export-html
: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
"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
"<a class=\"footref\" name=\"fnr.%s%s\" href=\"#fn.%s\">%s</a>"))
(or (match-string 1 line) "") n extra n n)
(concat
(format
(concat "%s"
(format org-export-html-footnote-format
(concat "<a class=\"footref\" name=\"fnr.%s%s\" href=\"#fn.%s\">%s</a>")))
(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

View File

@ -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))