[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Fwd: Don't treat [n] as a footnote, and export "[n]"
From: |
Rob Stewart |
Subject: |
Re: [O] Fwd: Don't treat [n] as a footnote, and export "[n]" |
Date: |
Thu, 23 Apr 2015 20:49:08 +0100 |
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 <address@hidden> wrote:
> Hello,
>
> Rob Stewart <address@hidden> 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