From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Fwd: Don't treat [n] as a footnote, and export "[n]" Date: Thu, 23 Apr 2015 21:40:39 +0200 Message-ID: <87lhhi1vm0.fsf@nicolasgoaziou.fr> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlMxz-00022D-6R for emacs-orgmode@gnu.org; Thu, 23 Apr 2015 15:39:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YlMxy-0004AI-3T for emacs-orgmode@gnu.org; Thu, 23 Apr 2015 15:39:19 -0400 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:57721) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlMxx-0004AC-TZ for emacs-orgmode@gnu.org; Thu, 23 Apr 2015 15:39:18 -0400 In-Reply-To: (Rob Stewart's message of "Thu, 23 Apr 2015 20:27:36 +0100") 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 Cc: emacs-orgmode@gnu.org 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