* Don't treat [n] as a footnote, and export "[n]"
@ 2015-04-23 19:10 Rob Stewart
2015-04-23 19:27 ` Fwd: " Rob Stewart
0 siblings, 1 reply; 6+ messages in thread
From: Rob Stewart @ 2015-04-23 19:10 UTC (permalink / raw)
To: emacs-orgmode
Hi,
I have the following in an org mode file (that do not want as inline
verbatim inside =foo=) :
int[2] a;
When I try exporting to HTML, I get the error:
org-export-get-footnote-definition: Definition not found for footnote 2
I've seen two solutions online:
http://emacsclub.github.io/html/org_tutorial.html
https://lists.gnu.org/archive/html/emacs-orgmode/2010-07/msg01248.html
The first works for me, i.e.
#+OPTIONS: f:nil
For this, though, the exported HTML omits the "[2]" text, i.e. the HTML is
int a;
How do I turn off footnotes for [n] where n is a number, so that "[n]"
is exported?
Thanks,
--
Rob
^ permalink raw reply [flat|nested] 6+ messages in thread
* Fwd: Don't treat [n] as a footnote, and export "[n]"
2015-04-23 19:10 Don't treat [n] as a footnote, and export "[n]" Rob Stewart
@ 2015-04-23 19:27 ` Rob Stewart
2015-04-23 19:40 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Rob Stewart @ 2015-04-23 19:27 UTC (permalink / raw)
To: emacs-orgmode
And just as soon as I send this email, I find the answer:
(setq org-footnote-re
(concat "\\[\\(?:"
;; Match inline footnotes.
(org-re "fn:\\([-_[:word:]]+\\)?:\\|")
;; Match other footnotes.
;; "\\(?:\\([0-9]+\\)\\]\\)\\|"
(org-re "\\(fn:[-_[:word:]]+\\)")
"\\)"))
(setq org-footnote-definition-re
(org-re "^\\[\\(fn:[-_[:word:]]+\\)\\]"))
From http://stackoverflow.com/a/25342297/1526266 .
--
Rob
---------- Forwarded message ----------
From: Rob Stewart <robstewart57@gmail.com>
Date: 23 April 2015 at 20:10
Subject: Don't treat [n] as a footnote, and export "[n]"
To: emacs-orgmode@gnu.org
Hi,
I have the following in an org mode file (that do not want as inline
verbatim inside =foo=) :
int[2] a;
When I try exporting to HTML, I get the error:
org-export-get-footnote-definition: Definition not found for footnote 2
I've seen two solutions online:
http://emacsclub.github.io/html/org_tutorial.html
https://lists.gnu.org/archive/html/emacs-orgmode/2010-07/msg01248.html
The first works for me, i.e.
#+OPTIONS: f:nil
For this, though, the exported HTML omits the "[2]" text, i.e. the HTML is
int a;
How do I turn off footnotes for [n] where n is a number, so that "[n]"
is exported?
Thanks,
--
Rob
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Fwd: Don't treat [n] as a footnote, and export "[n]"
2015-04-23 19:27 ` Fwd: " Rob Stewart
@ 2015-04-23 19:40 ` Nicolas Goaziou
2015-04-23 19:49 ` Rob Stewart
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2015-04-23 19:40 UTC (permalink / raw)
To: Rob Stewart; +Cc: emacs-orgmode
Hello,
Rob Stewart <robstewart57@gmail.com> writes:
> And just as soon as I send this email, I find the answer:
[num] syntax for footnotes is indeed a pain.
However, the solution below is really a kludge because some parts of Org
(or external libraries) could hard-code it anyway.
> (setq org-footnote-re
> (concat "\\[\\(?:"
> ;; Match inline footnotes.
> (org-re "fn:\\([-_[:word:]]+\\)?:\\|")
> ;; Match other footnotes.
> ;; "\\(?:\\([0-9]+\\)\\]\\)\\|"
> (org-re "\\(fn:[-_[:word:]]+\\)")
> "\\)"))
>
> (setq org-footnote-definition-re
> (org-re "^\\[\\(fn:[-_[:word:]]+\\)\\]"))
>
> From http://stackoverflow.com/a/25342297/1526266 .
From an export perspective, you can turn these footnotes back into
regular text at the parse tree level:
--8<---------------cut here---------------start------------->8---
(defun my-ignore-false-footnotes (ast backend info)
(org-element-map ast 'footnote-reference
(lambda (f)
(let ((label (org-element-property :label f)))
(when (org-string-match-p "\\`[0-9]+\\'" label)
(org-element-set-element
f
(concat "[" label "]"
(make-string (org-element-property :post-blank f) ?\s)))))))
ast)
(add-to-list org-export-filter-parse-tree-functions #'my-ignore-false-footnotes)
--8<---------------cut here---------------end--------------->8---
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Fwd: Don't treat [n] as a footnote, and export "[n]"
2015-04-23 19:40 ` Nicolas Goaziou
@ 2015-04-23 19:49 ` Rob Stewart
2015-04-23 19:53 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Rob Stewart @ 2015-04-23 19:49 UTC (permalink / raw)
To: Rob Stewart, emacs-orgmode
Hi Nicolas,
For the last line:
(add-to-list org-export-filter-parse-tree-functions #'my-ignore-false-footnotes)
I'm getting
Debugger entered--Lisp error: (wrong-type-argument symbolp
(org-bibtex-merge-contiguous-citations org-bibtex-process-bib-files))
add-to-list((org-bibtex-merge-contiguous-citations
org-bibtex-process-bib-files) my-ignore-false-footnotes)
eval((add-to-list org-export-filter-parse-tree-functions (function
my-ignore-false-footnotes)) nil)
eval-last-sexp-1(nil)
eval-last-sexp(nil)
call-interactively(eval-last-sexp nil nil)
command-execute(eval-last-sexp)
? Thanks,
--
Rob
On 23 April 2015 at 20:40, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> Hello,
>
> Rob Stewart <robstewart57@gmail.com> writes:
>
>> And just as soon as I send this email, I find the answer:
>
> [num] syntax for footnotes is indeed a pain.
>
> However, the solution below is really a kludge because some parts of Org
> (or external libraries) could hard-code it anyway.
>
>> (setq org-footnote-re
>> (concat "\\[\\(?:"
>> ;; Match inline footnotes.
>> (org-re "fn:\\([-_[:word:]]+\\)?:\\|")
>> ;; Match other footnotes.
>> ;; "\\(?:\\([0-9]+\\)\\]\\)\\|"
>> (org-re "\\(fn:[-_[:word:]]+\\)")
>> "\\)"))
>>
>> (setq org-footnote-definition-re
>> (org-re "^\\[\\(fn:[-_[:word:]]+\\)\\]"))
>>
>> From http://stackoverflow.com/a/25342297/1526266 .
>
> From an export perspective, you can turn these footnotes back into
> regular text at the parse tree level:
>
> --8<---------------cut here---------------start------------->8---
> (defun my-ignore-false-footnotes (ast backend info)
> (org-element-map ast 'footnote-reference
> (lambda (f)
> (let ((label (org-element-property :label f)))
> (when (org-string-match-p "\\`[0-9]+\\'" label)
> (org-element-set-element
> f
> (concat "[" label "]"
> (make-string (org-element-property :post-blank f) ?\s)))))))
> ast)
>
> (add-to-list org-export-filter-parse-tree-functions #'my-ignore-false-footnotes)
> --8<---------------cut here---------------end--------------->8---
>
>
> Regards,
>
> --
> Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Fwd: Don't treat [n] as a footnote, and export "[n]"
2015-04-23 19:49 ` Rob Stewart
@ 2015-04-23 19:53 ` Nicolas Goaziou
2015-04-23 20:03 ` Rob Stewart
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2015-04-23 19:53 UTC (permalink / raw)
To: Rob Stewart; +Cc: emacs-orgmode
Rob Stewart <robstewart57@gmail.com> writes:
> For the last line:
>
> (add-to-list org-export-filter-parse-tree-functions #'my-ignore-false-footnotes)
Typo. It should be
(add-to-list 'org-export-filter-parse-tree-functions #'my-ignore-false-footnotes)
Regards,
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Fwd: Don't treat [n] as a footnote, and export "[n]"
2015-04-23 19:53 ` Nicolas Goaziou
@ 2015-04-23 20:03 ` Rob Stewart
0 siblings, 0 replies; 6+ messages in thread
From: Rob Stewart @ 2015-04-23 20:03 UTC (permalink / raw)
To: Rob Stewart, emacs-orgmode
On 23 April 2015 at 20:53, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> (add-to-list 'org-export-filter-parse-tree-functions #'my-ignore-false-footnotes)
Perfect, that works. Thanks Nicolas,
--
Rob
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-04-23 20:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-23 19:10 Don't treat [n] as a footnote, and export "[n]" Rob Stewart
2015-04-23 19:27 ` Fwd: " Rob Stewart
2015-04-23 19:40 ` Nicolas Goaziou
2015-04-23 19:49 ` Rob Stewart
2015-04-23 19:53 ` Nicolas Goaziou
2015-04-23 20:03 ` Rob Stewart
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).