emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ODT export: Issues with `org-export-footnote-first-reference-p'
@ 2015-02-10 11:17 Vaidheeswaran
  2015-02-10 12:56 ` Christian Moe
  0 siblings, 1 reply; 17+ messages in thread
From: Vaidheeswaran @ 2015-02-10 11:17 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 517 bytes --]


The attached file, when exported to ODT fails to open in LibreOffice
exporter.  The reason failure is that the exported __XML__ file has
"nested footnote definiton" i.e., a footnote definition within a
footnote definiton.  In concrete terms, there is some confusion wrt
the return value of `org-export-footnote-first-reference-p'.

(Hint: Start with `org-odt-footnote-reference'.  If my hunch is right,
the `org-export-data' invocation there may also need a fix).

I will be happy to circulate a patch to ox-odt.el.

[-- Attachment #2: test.org --]
[-- Type: text/plain, Size: 95 bytes --]

text1 [fn:1]

#+BEGIN_QUOTE
text2 [fn:2]
#+END_QUOTE

[fn:1] footdef1.[fn:2]

[fn:2] footdef2


[-- Attachment #3: test.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 10254 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ODT export: Issues with `org-export-footnote-first-reference-p'
  2015-02-10 11:17 ODT export: Issues with `org-export-footnote-first-reference-p' Vaidheeswaran
@ 2015-02-10 12:56 ` Christian Moe
  2015-02-10 14:22   ` Vaidheeswaran C
  2015-02-10 21:28   ` Nicolas Goaziou
  0 siblings, 2 replies; 17+ messages in thread
From: Christian Moe @ 2015-02-10 12:56 UTC (permalink / raw)
  To: Vaidheeswaran; +Cc: emacs-orgmode


Hi,

Thanks for this. You have

  [fn:1] footdef1[fn:2]

  [fn:2] footdef2

What do you expect to see in ODT? Presumably not a footnote in a
footnote, since LibreOffice doesn't allow you to place one.

An ODT cross-reference to the footnote? That makes sense, but should
that be achieved by footnoting inside a footnote, or is the appropriate
thing to do to use a dedicated target and link?

  [fn:1] footdef1, see also [[thatotherfootnote]].

  [fn:2] <<thatotherfootnote>>footdef2

That seems to works nicely e.g. in HTML export.

But I get an error message when I try it in ODT export (OpenDocument
export failed: number-or-marker-p, nil -- can't be more detailed at the
moment because my debugger doesn't seem to work correctly).

So either way, there seems to be something that needs fixing.

Yours,
Christian


Vaidheeswaran writes:

> The attached file, when exported to ODT fails to open in LibreOffice
> exporter.  The reason failure is that the exported __XML__ file has
> "nested footnote definiton" i.e., a footnote definition within a
> footnote definiton.  In concrete terms, there is some confusion wrt
> the return value of `org-export-footnote-first-reference-p'.
>
> (Hint: Start with `org-odt-footnote-reference'.  If my hunch is right,
> the `org-export-data' invocation there may also need a fix).
>
> I will be happy to circulate a patch to ox-odt.el.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ODT export: Issues with `org-export-footnote-first-reference-p'
  2015-02-10 12:56 ` Christian Moe
@ 2015-02-10 14:22   ` Vaidheeswaran C
  2015-02-10 21:29     ` Nicolas Goaziou
  2015-02-10 21:28   ` Nicolas Goaziou
  1 sibling, 1 reply; 17+ messages in thread
From: Vaidheeswaran C @ 2015-02-10 14:22 UTC (permalink / raw)
  To: Christian Moe; +Cc: emacs-orgmode

On Tuesday 10 February 2015 06:26 PM, Christian Moe wrote:
> Thanks for this. You have
>
>    [fn:1] footdef1[fn:2]
>
>    [fn:2] footdef2
>
> What do you expect to see in ODT? Presumably not a footnote in a
> footnote, since LibreOffice doesn't allow you to place one.
>
> An ODT cross-reference to the footnote? That makes sense,

Yes.

> but should that be achieved by footnoting inside a footnote

Yes, just like that in the snippet.

That said, it is difficult for me to conceive of a footnote that is
referenced solely by other footnotes. i.e., it is reasonable to assume
that a given footnote is either not referenced at all or is referenced
atleast once in the main text itself.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ODT export: Issues with `org-export-footnote-first-reference-p'
  2015-02-10 12:56 ` Christian Moe
  2015-02-10 14:22   ` Vaidheeswaran C
@ 2015-02-10 21:28   ` Nicolas Goaziou
  2015-02-11  6:02     ` Vaidheeswaran
  1 sibling, 1 reply; 17+ messages in thread
From: Nicolas Goaziou @ 2015-02-10 21:28 UTC (permalink / raw)
  To: Christian Moe; +Cc: Vaidheeswaran, emacs-orgmode

Hello,

Christian Moe <mail@christianmoe.com> writes:

> An ODT cross-reference to the footnote? That makes sense, but should
> that be achieved by footnoting inside a footnote, or is the appropriate
> thing to do to use a dedicated target and link?
>
>   [fn:1] footdef1, see also [[thatotherfootnote]].
>
>   [fn:2] <<thatotherfootnote>>footdef2
>
> That seems to works nicely e.g. in HTML export.
>
> But I get an error message when I try it in ODT export (OpenDocument
> export failed: number-or-marker-p, nil -- can't be more detailed at the
> moment because my debugger doesn't seem to work correctly).

This should be fixed. Thank you.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ODT export: Issues with `org-export-footnote-first-reference-p'
  2015-02-10 14:22   ` Vaidheeswaran C
@ 2015-02-10 21:29     ` Nicolas Goaziou
  2015-02-11  4:46       ` Vaidheeswaran C
  0 siblings, 1 reply; 17+ messages in thread
From: Nicolas Goaziou @ 2015-02-10 21:29 UTC (permalink / raw)
  To: Vaidheeswaran C; +Cc: emacs-orgmode, Christian Moe

Hello,

Vaidheeswaran C <vaidheeswaran.chinnaraju@gmail.com> writes:

> That said, it is difficult for me to conceive of a footnote that is
> referenced solely by other footnotes. i.e., it is reasonable to assume
> that a given footnote is either not referenced at all or is referenced
> atleast once in the main text itself.

There's no need to make such an assumption.

Using link-target within the footnotes should be fixed. Thank you.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ODT export: Issues with `org-export-footnote-first-reference-p'
  2015-02-10 21:29     ` Nicolas Goaziou
@ 2015-02-11  4:46       ` Vaidheeswaran C
  2015-02-11 21:12         ` Nicolas Goaziou
  0 siblings, 1 reply; 17+ messages in thread
From: Vaidheeswaran C @ 2015-02-11  4:46 UTC (permalink / raw)
  To: emacs-orgmode

On Wednesday 11 February 2015 02:59 AM, Nicolas Goaziou wrote:
> Hello,
>
> Vaidheeswaran C<vaidheeswaran.chinnaraju@gmail.com>  writes:
>
>> That said, it is difficult for me to conceive of a footnote that is
>> referenced solely by other footnotes. i.e., it is reasonable to assume
>> that a given footnote is either not referenced at all or is referenced
>> atleast once in the main text itself.
>
> There's no need to make such an assumption.

I still think that the snippet I shared should have worked.  Clearly
`org-export-footnote-first-reference-p' is misbehaving.

> Using link-target within the footnotes should be fixed. Thank you.

This could be a workaround.  But it introduces the overhead of
conjuring up a new link.  Instead of sneaking a <<>> link right in to
the text, another alternative would be to go with:

     #+NAME: test
     [fn:1] footdef1.

> Regards,
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ODT export: Issues with `org-export-footnote-first-reference-p'
  2015-02-10 21:28   ` Nicolas Goaziou
@ 2015-02-11  6:02     ` Vaidheeswaran
  2015-02-11  6:10       ` Vaidheeswaran
  0 siblings, 1 reply; 17+ messages in thread
From: Vaidheeswaran @ 2015-02-11  6:02 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 777 bytes --]

On Wednesday 11 February 2015 02:58 AM, Nicolas Goaziou wrote:
> Hello,
>
> Christian Moe<mail@christianmoe.com>  writes:
>
>> An ODT cross-reference to the footnote? That makes sense, but should
>> that be achieved by footnoting inside a footnote, or is the appropriate
>> thing to do to use a dedicated target and link?
>>
>>    [fn:1] footdef1, see also [[thatotherfootnote]].
>>
>>    [fn:2]<<thatotherfootnote>>footdef2
>>
>> That seems to works nicely e.g. in HTML export.
>>
>> But I get an error message when I try it in ODT export (OpenDocument
>> export failed: number-or-marker-p, nil -- can't be more detailed at the
>> moment because my debugger doesn't seem to work correctly).
>
> This should be fixed. Thank you.

Not yet.  See attached files.

>
> Regards,
>


[-- Attachment #2: test.org --]
[-- Type: text/plain, Size: 122 bytes --]

text1 [fn:1][fn:2][fn:3]

[fn:1] footdef1 [[fn-3]]

[fn:2] footdef2 [[See foonotnote 3][fn-3]]

[fn:3] <<fn-2>> footdef2


[-- Attachment #3: test.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 10068 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ODT export: Issues with `org-export-footnote-first-reference-p'
  2015-02-11  6:02     ` Vaidheeswaran
@ 2015-02-11  6:10       ` Vaidheeswaran
  0 siblings, 0 replies; 17+ messages in thread
From: Vaidheeswaran @ 2015-02-11  6:10 UTC (permalink / raw)
  Cc: emacs-orgmode

On Wednesday 11 February 2015 11:32 AM, Vaidheeswaran wrote:
>> This should be fixed. Thank you.
>
> Not yet.  See attached files.

Operator error.  Sorry.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ODT export: Issues with `org-export-footnote-first-reference-p'
  2015-02-11  4:46       ` Vaidheeswaran C
@ 2015-02-11 21:12         ` Nicolas Goaziou
  2015-02-12  4:44           ` Vaidheeswaran
  0 siblings, 1 reply; 17+ messages in thread
From: Nicolas Goaziou @ 2015-02-11 21:12 UTC (permalink / raw)
  To: Vaidheeswaran C; +Cc: emacs-orgmode

Vaidheeswaran C <vaidheeswaran.chinnaraju@gmail.com> writes:

> I still think that the snippet I shared should have worked.  Clearly
> `org-export-footnote-first-reference-p' is misbehaving.

It does, e.g., when exporting to LaTeX. This is an odt limitation.  So,
I disagree, `org-export-footnote-first-reference-p' is correct here.


Regards,

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ODT export: Issues with `org-export-footnote-first-reference-p'
  2015-02-11 21:12         ` Nicolas Goaziou
@ 2015-02-12  4:44           ` Vaidheeswaran
  2015-02-12  7:19             ` Thomas S. Dye
  2015-02-13  0:18             ` Nicolas Goaziou
  0 siblings, 2 replies; 17+ messages in thread
From: Vaidheeswaran @ 2015-02-12  4:44 UTC (permalink / raw)
  To: emacs-orgmode

On Thursday 12 February 2015 02:42 AM, Nicolas Goaziou wrote:
> It does, e.g., when exporting to LaTeX. This is an odt limitation.  So,
> I disagree, `org-export-footnote-first-reference-p' is correct here.


Let me put my question this way:

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.  Would it be 
possible for you to augment the API so that I can request such a reference.

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.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ODT export: Issues with `org-export-footnote-first-reference-p'
  2015-02-12  4:44           ` Vaidheeswaran
@ 2015-02-12  7:19             ` Thomas S. Dye
  2015-02-12  7:50               ` Vaidheeswaran C
  2015-02-13  0:18             ` Nicolas Goaziou
  1 sibling, 1 reply; 17+ messages in thread
From: Thomas S. Dye @ 2015-02-12  7:19 UTC (permalink / raw)
  To: Vaidheeswaran; +Cc: emacs-orgmode

Aloha Vaidheeswaran,

This is an odd example that I don't recall having seen in any
publication.  I don't doubt examples might exist, but don't remember
having seen one.  Can you point me to a real-world example of a footnote
referring to a subsequent footnote that I might reference either on-line
or in my local library?

All the best,
Tom

Vaidheeswaran <vaidheeswaran.chinnaraju@gmail.com> writes:

> On Thursday 12 February 2015 02:42 AM, Nicolas Goaziou wrote:
>> It does, e.g., when exporting to LaTeX. This is an odt limitation.  So,
>> I disagree, `org-export-footnote-first-reference-p' is correct here.
>
>
> Let me put my question this way:
>
> 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.  Would it be
> possible for you to augment the API so that I can request such a
> reference.
>
> 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.
>
>
>
>
>

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ODT export: Issues with `org-export-footnote-first-reference-p'
  2015-02-12  7:19             ` Thomas S. Dye
@ 2015-02-12  7:50               ` Vaidheeswaran C
  2015-02-12 16:25                 ` Thomas S. Dye
  0 siblings, 1 reply; 17+ messages in thread
From: Vaidheeswaran C @ 2015-02-12  7:50 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 3376 bytes --]

On Thursday 12 February 2015 12:49 PM, Thomas S. Dye wrote:
> Aloha Vaidheeswaran,
>
> This is an odd example that I don't recall having seen in any
> publication.  I don't doubt examples might exist, but don't remember
> having seen one.  Can you point me to a real-world example of a footnote
> referring to a subsequent footnote that I might reference either on-line
> or in my local library?

I am OCRing this book:
http://wenshuchan-online.weebly.com/uploads/9/4/8/2/9482304/chan-and-zen-teachingpdf.pdf. 
  This book is atleast 50 years old.

You can find the converted files here:
https://archive.org/details/TheDiamondCutterOfDoubts


The actual text extract goes something as below.  I am attaching the 
scanned image of the book in question.


------------------------

# page 159

Now they saw uncountable and limitless numbers of living beings in the
universe[fn:145-1] and wondered when all these beings could be saved
and how they could obtain the Buddha fruit since the universe would
never be emptied of these beings.


# page 169

#+BEGIN_QUOTE

'Subhuti, what do you think? If someone filled the Universe[fn:155-4]
with the seven treasures[fn:155-5] and gave them all as alms, would
his merit be great?’

Subhuti replied: 'Very great, World Honoured One. Why? Because this
merit is not the nature of merit, the Tathagata says it is
great.’[fn:155-6]

‘Subhuti, if on the other hand, someone received and kept even a four
line stanza of this sutra and expounded it to others, his merit would
surpass that (of the giver of treasures). Why? (Because), Subhuti, all
Buddhas and their Supreme-Enlightenment-Dharma originate from this
sutra. Subhuti, the so-called Buddhas and Dharmas are not real Buddhas
and Dharmas.'[fn:155-7]

#+END_QUOTE

[fn:145-1] Literally ‘the great trichiliocosm’. See footnote 4, p. 
169.[fn:155-4]

[fn:155-4] Tri-sahasra-maha-sahasra-loka-dhatu=a great
trichiliocosm. Mt. Sumeru and its seven surrounding continents, eight
seas and ring of iron mountains form one small world; 1,000 of these
form a small chiliocosm; 1,000 of these small chiliocosms form a
medium chiliocosm; 1,000 of these form a great chiliocosm, which
consists of 1,000,000,000 small worlds. The word ‘universe’ is used
for convenience sake.





> All the best,
> Tom
>
> Vaidheeswaran<vaidheeswaran.chinnaraju@gmail.com>  writes:
>
>> On Thursday 12 February 2015 02:42 AM, Nicolas Goaziou wrote:
>>> It does, e.g., when exporting to LaTeX. This is an odt limitation.  So,
>>> I disagree, `org-export-footnote-first-reference-p' is correct here.
>>
>>
>> Let me put my question this way:
>>
>> 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.  Would it be
>> possible for you to augment the API so that I can request such a
>> reference.
>>
>> 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.
>>
>>
>>
>>
>>
>


[-- Attachment #2: footnote-reference-in-a-footnote-definition.png --]
[-- Type: image/png, Size: 82746 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ODT export: Issues with `org-export-footnote-first-reference-p'
  2015-02-12  7:50               ` Vaidheeswaran C
@ 2015-02-12 16:25                 ` Thomas S. Dye
  0 siblings, 0 replies; 17+ messages in thread
From: Thomas S. Dye @ 2015-02-12 16:25 UTC (permalink / raw)
  To: Vaidheeswaran C; +Cc: emacs-orgmode

Aloha Vaidheeswaran,

Thanks very much for the detailed response and the link to the book.

That's an interesting example I won't soon forget.  The forward
reference in the footnote is unusual.  In this case it appears to be
standing in for the lack of an index entry for either "trichiliocosm" or
"chiliocosm."

It's eye opening to see Org mode at work so deep in the humanities.

All the best,
Tom

Vaidheeswaran C <vaidheeswaran.chinnaraju@gmail.com> writes:

> On Thursday 12 February 2015 12:49 PM, Thomas S. Dye wrote:
>> Aloha Vaidheeswaran,
>>
>> This is an odd example that I don't recall having seen in any
>> publication.  I don't doubt examples might exist, but don't remember
>> having seen one.  Can you point me to a real-world example of a footnote
>> referring to a subsequent footnote that I might reference either on-line
>> or in my local library?
>
> I am OCRing this book:
> http://wenshuchan-online.weebly.com/uploads/9/4/8/2/9482304/chan-and-zen-teachingpdf.pdf.
>   This book is atleast 50 years old.
>
> You can find the converted files here:
> https://archive.org/details/TheDiamondCutterOfDoubts
>
>
> The actual text extract goes something as below.  I am attaching the 
> scanned image of the book in question.
>
>
> ------------------------
>
> # page 159
>
> Now they saw uncountable and limitless numbers of living beings in the
> universe[fn:145-1] and wondered when all these beings could be saved
> and how they could obtain the Buddha fruit since the universe would
> never be emptied of these beings.
>
>
> # page 169
>
> #+BEGIN_QUOTE
>
> 'Subhuti, what do you think? If someone filled the Universe[fn:155-4]
> with the seven treasures[fn:155-5] and gave them all as alms, would
> his merit be great?
>
> Subhuti replied: 'Very great, World Honoured One. Why? Because this
> merit is not the nature of merit, the Tathagata says it is
> great.[fn:155-6]
>
> Subhuti, if on the other hand, someone received and kept even a four
> line stanza of this sutra and expounded it to others, his merit would
> surpass that (of the giver of treasures). Why? (Because), Subhuti, all
> Buddhas and their Supreme-Enlightenment-Dharma originate from this
> sutra. Subhuti, the so-called Buddhas and Dharmas are not real Buddhas
> and Dharmas.'[fn:155-7]
>
> #+END_QUOTE
>
> [fn:145-1] Literally ‘the great trichiliocosm’. See footnote 4, p. 
> 169.[fn:155-4]
>
> [fn:155-4] Tri-sahasra-maha-sahasra-loka-dhatu=a great
> trichiliocosm. Mt. Sumeru and its seven surrounding continents, eight
> seas and ring of iron mountains form one small world; 1,000 of these
> form a small chiliocosm; 1,000 of these small chiliocosms form a
> medium chiliocosm; 1,000 of these form a great chiliocosm, which
> consists of 1,000,000,000 small worlds. The word ‘universe’ is used
> for convenience sake.
>
>
>
>
>
>> All the best,
>> Tom
>>
>> Vaidheeswaran<vaidheeswaran.chinnaraju@gmail.com>  writes:
>>
>>> On Thursday 12 February 2015 02:42 AM, Nicolas Goaziou wrote:
>>>> It does, e.g., when exporting to LaTeX. This is an odt limitation.  So,
>>>> I disagree, `org-export-footnote-first-reference-p' is correct here.
>>>
>>>
>>> Let me put my question this way:
>>>
>>> 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.  Would it be
>>> possible for you to augment the API so that I can request such a
>>> reference.
>>>
>>> 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.
>>>
>>>
>>>
>>>
>>>
>>
>
>

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ODT export: Issues with `org-export-footnote-first-reference-p'
  2015-02-12  4:44           ` Vaidheeswaran
  2015-02-12  7:19             ` Thomas S. Dye
@ 2015-02-13  0:18             ` Nicolas Goaziou
  2015-02-13  7:37               ` Vaidheeswaran C
       [not found]               ` <m2vbj61bdc.fsf@christianmoe.com>
  1 sibling, 2 replies; 17+ messages in thread
From: Nicolas Goaziou @ 2015-02-13  0:18 UTC (permalink / raw)
  To: Vaidheeswaran; +Cc: emacs-orgmode

Vaidheeswaran <vaidheeswaran.chinnaraju@gmail.com> 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,

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ODT export: Issues with `org-export-footnote-first-reference-p'
  2015-02-13  0:18             ` Nicolas Goaziou
@ 2015-02-13  7:37               ` Vaidheeswaran C
  2015-02-13 13:18                 ` Nicolas Goaziou
       [not found]               ` <m2vbj61bdc.fsf@christianmoe.com>
  1 sibling, 1 reply; 17+ messages in thread
From: Vaidheeswaran C @ 2015-02-13  7:37 UTC (permalink / raw)
  To: emacs-orgmode



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<vaidheeswaran.chinnaraju@gmail.com>  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,

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ODT export: Issues with `org-export-footnote-first-reference-p'
  2015-02-13  7:37               ` Vaidheeswaran C
@ 2015-02-13 13:18                 ` Nicolas Goaziou
  0 siblings, 0 replies; 17+ messages in thread
From: Nicolas Goaziou @ 2015-02-13 13:18 UTC (permalink / raw)
  To: Vaidheeswaran C; +Cc: emacs-orgmode

Vaidheeswaran C <vaidheeswaran.chinnaraju@gmail.com> writes:

> 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.

Too late.

Having slept over your idea, I think you're right. We should extend
footnote export API to provide an alternate order for tree walking, as
long as footnote definitions are not ignored.

This should now be fixed in master.

Of course, if you find something new, we can always make further
changes.

Thank you.

Regards,

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: ODT export: Issues with `org-export-footnote-first-reference-p'
       [not found]               ` <m2vbj61bdc.fsf@christianmoe.com>
@ 2015-02-13 13:23                 ` Nicolas Goaziou
  0 siblings, 0 replies; 17+ messages in thread
From: Nicolas Goaziou @ 2015-02-13 13:23 UTC (permalink / raw)
  To: Christian Moe; +Cc: Vaidheeswaran, emacs-orgmode

Hello,

Christian Moe <mail@christianmoe.com> writes:

> Would it make sense to be able to link to a footnote label? Rationale:
>
> 1. If a footnote definition is already meaningfully labeled, a dedicated
> target is redundant.
>
> 2. Since you can link to named tables, source blocks etc., users might
> expect to be able to do the same with labeled footnote definitions.
>
> So given a link like [[labeledfootnote]], could Org-mode look for a
> footnote definition with that label -- e.g. after looking for a
> dedicated target or a #+name'd element, and before doing a text search?
> Or is there a reason why it shouldn't?

First and foremost, mixing links and footnotes would be a maintenance
burden. The link-target association does just that, and I think it is
sufficient.

Also, Org can renumber automatically footnotes, so it should also check
every link in the buffer to possibly update it.

I think it's a false good idea.


Regards,

-- 
Nicolas Goaziou                                                0x80A93738

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2015-02-13 13:22 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-10 11:17 ODT export: Issues with `org-export-footnote-first-reference-p' Vaidheeswaran
2015-02-10 12:56 ` Christian Moe
2015-02-10 14:22   ` Vaidheeswaran C
2015-02-10 21:29     ` Nicolas Goaziou
2015-02-11  4:46       ` Vaidheeswaran C
2015-02-11 21:12         ` Nicolas Goaziou
2015-02-12  4:44           ` Vaidheeswaran
2015-02-12  7:19             ` Thomas S. Dye
2015-02-12  7:50               ` Vaidheeswaran C
2015-02-12 16:25                 ` Thomas S. Dye
2015-02-13  0:18             ` Nicolas Goaziou
2015-02-13  7:37               ` Vaidheeswaran C
2015-02-13 13:18                 ` Nicolas Goaziou
     [not found]               ` <m2vbj61bdc.fsf@christianmoe.com>
2015-02-13 13:23                 ` Nicolas Goaziou
2015-02-10 21:28   ` Nicolas Goaziou
2015-02-11  6:02     ` Vaidheeswaran
2015-02-11  6:10       ` Vaidheeswaran

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).