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

2015-02-13 Thread Nicolas Goaziou
Hello,

Christian Moe m...@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 Goaziou0x80A93738



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

2015-02-13 Thread Nicolas Goaziou
Vaidheeswaran C vaidheeswaran.chinnar...@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,



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

2015-02-12 Thread Nicolas Goaziou
Vaidheeswaran vaidheeswaran.chinnar...@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,



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

2015-02-12 Thread Vaidheeswaran C



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:

Vaidheeswaranvaidheeswaran.chinnar...@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,





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

2015-02-12 Thread Thomas S. Dye
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.chinnar...@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

 Vaidheeswaranvaidheeswaran.chinnar...@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



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

2015-02-11 Thread Nicolas Goaziou
Vaidheeswaran C vaidheeswaran.chinnar...@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,



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

2015-02-11 Thread Vaidheeswaran

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.







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

2015-02-11 Thread Vaidheeswaran C

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

Vaidheeswaranvaidheeswaran.chinnar...@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.











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

2015-02-11 Thread Thomas S. Dye
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.chinnar...@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



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

2015-02-10 Thread Vaidheeswaran C

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.




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

2015-02-10 Thread Nicolas Goaziou
Hello,

Vaidheeswaran C vaidheeswaran.chinnar...@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



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

2015-02-10 Thread Nicolas Goaziou
Hello,

Christian Moe m...@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] thatotherfootnotefootdef2

 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



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

2015-02-10 Thread Vaidheeswaran

On Wednesday 11 February 2015 11:32 AM, Vaidheeswaran wrote:

This should be fixed. Thank you.


Not yet.  See attached files.


Operator error.  Sorry.




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

2015-02-10 Thread Vaidheeswaran C

On Wednesday 11 February 2015 02:59 AM, Nicolas Goaziou wrote:

Hello,

Vaidheeswaran Cvaidheeswaran.chinnar...@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,






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

2015-02-10 Thread Vaidheeswaran

On Wednesday 11 February 2015 02:58 AM, Nicolas Goaziou wrote:

Hello,

Christian Moem...@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]thatotherfootnotefootdef2

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,



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



test.odt
Description: application/vnd.oasis.opendocument.text


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

2015-02-10 Thread Christian Moe

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] thatotherfootnotefootdef2

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.