emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] ODT export: Issues with `org-export-footnote-first-reference-p'


From: Vaidheeswaran C
Subject: Re: [O] ODT export: Issues with `org-export-footnote-first-reference-p'
Date: Fri, 13 Feb 2015 13:07:23 +0530
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20121216 Icedove/3.0.11



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<address@hidden>  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,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]