From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: ODT export: Issues with `org-export-footnote-first-reference-p' Date: Fri, 13 Feb 2015 01:18:03 +0100 Message-ID: <877fvmvf44.fsf@nicolasgoaziou.fr> References: <54DA141C.1080407@gmail.com> <8761b9xxo9.fsf@nicolasgoaziou.fr> <54DADEA3.8070701@gmail.com> <87k2zow3sq.fsf@nicolasgoaziou.fr> <54DC2F94.90109@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YM3wW-0006BE-SO for emacs-orgmode@gnu.org; Thu, 12 Feb 2015 19:17:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YM3wG-00021N-OC for emacs-orgmode@gnu.org; Thu, 12 Feb 2015 19:17:12 -0500 Received: from relay6-d.mail.gandi.net ([2001:4b98:c:538::198]:49923) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YM3wG-0001yI-DX for emacs-orgmode@gnu.org; Thu, 12 Feb 2015 19:16:56 -0500 In-Reply-To: <54DC2F94.90109@gmail.com> (Vaidheeswaran's message of "Thu, 12 Feb 2015 10:14:04 +0530") 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: Vaidheeswaran Cc: emacs-orgmode@gnu.org Vaidheeswaran writes: > What changes need to be made in ox.el and/or ox-odt.el so that the > snippet I shared produces the right XML acceptable for LibreOffice. > > text1 [fn:1] > > text2 [fn:2] > > [fn:1] footdef1[fn:2] > > [fn:2] footdef2 > > For purposes of ODT backend, we need to find the 'site of first > reference' THAT IS OUTSIDE OF A foonote definition. I think the following should work (defun org-odt-footnote-first-reference-p (footnote-reference info) "Non-nil when FOOTNOTE-REFERENCE is the first one for its label. INFO is a plist containing current export state. Unlike to `org-export-footnote-first-reference-p', this function ignores footnote definitions. As a consequence, it assumes that for a given label, there is at least one footnote reference outside any footnote definition in the document." (let ((label (org-element-property :label footnote-reference))) (or (not label) (eq footnote-reference (org-element-map (plist-get info :parse-tree) 'footnote-reference (lambda (fn) (and (equal (org-element-property :label fn) label) fn)) info t 'footnote-definition))))) > Would it be possible for you to augment the API so that I can request > such a reference. I'd rather not change the API, as this makes an unnecessary assumption. Note that `org-export-get-footnote-number' also assumes the same. E.g. text1 [fn:foo] text2 [fn:quux] text3 [fn:bar] [fn:foo] footdeffoo[fn:bar] [fn:bar] footdefbar [fn:quux] footdefquux > NOTE: The XML that is emitted by the ODT exporter, suggests that the > '[fn:2]' occurring in '[fn:1]' is treated as site of first reference. > We would like to make '[fn:2]' occurring next to 'text2' be treated as > the site of first reference. If we do that, everything will be just > right. If the function above works for your use case, I'll install a patch in ox-odt. Regards,