From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vaidheeswaran C Subject: Re: ODT export: Issues with `org-export-footnote-first-reference-p' Date: Fri, 13 Feb 2015 13:07:23 +0530 Message-ID: <54DDA9B3.6010208@gmail.com> References: <54DA141C.1080407@gmail.com> <8761b9xxo9.fsf@nicolasgoaziou.fr> <54DADEA3.8070701@gmail.com> <87k2zow3sq.fsf@nicolasgoaziou.fr> <54DC2F94.90109@gmail.com> <877fvmvf44.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMAmO-0006V8-2c for emacs-orgmode@gnu.org; Fri, 13 Feb 2015 02:35:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YMAmK-0003oa-Ic for emacs-orgmode@gnu.org; Fri, 13 Feb 2015 02:35:11 -0500 Received: from mail-pa0-x22c.google.com ([2607:f8b0:400e:c03::22c]:33751) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMAmK-0003oC-An for emacs-orgmode@gnu.org; Fri, 13 Feb 2015 02:35:08 -0500 Received: by mail-pa0-f44.google.com with SMTP id kq14so17183048pab.3 for ; Thu, 12 Feb 2015 23:35:07 -0800 (PST) Received: from [192.168.43.83] ([117.96.15.187]) by mx.google.com with ESMTPSA id if10sm5814938pad.38.2015.02.12.23.35.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Feb 2015 23:35:06 -0800 (PST) In-Reply-To: <877fvmvf44.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: emacs-orgmode@gnu.org Allow me to revisit this thread in a week or 10 days so that I can 1. take a look at ODF standard. 2. dig in to LibreOffice discussion lists to see whether such instances have ever surfaced (and how they were dealt with). Until then, please keep the patch in waiting. On Friday 13 February 2015 05:48 AM, Nicolas Goaziou wrote: > 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,