From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rob Stewart Subject: Re: Fwd: Don't treat [n] as a footnote, and export "[n]" Date: Thu, 23 Apr 2015 20:49:08 +0100 Message-ID: References: <87lhhi1vm0.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlN7r-0004K5-He for emacs-orgmode@gnu.org; Thu, 23 Apr 2015 15:49:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YlN7q-0007Sl-7o for emacs-orgmode@gnu.org; Thu, 23 Apr 2015 15:49:31 -0400 Received: from mail-lb0-x231.google.com ([2a00:1450:4010:c04::231]:35933) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlN7q-0007Sg-0C for emacs-orgmode@gnu.org; Thu, 23 Apr 2015 15:49:30 -0400 Received: by lbbqq2 with SMTP id qq2so21273898lbb.3 for ; Thu, 23 Apr 2015 12:49:29 -0700 (PDT) In-Reply-To: <87lhhi1vm0.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rob Stewart , emacs-orgmode@gnu.org 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 wrote: > Hello, > > Rob Stewart 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