emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Vaidheeswaran <vaidheeswaran.chinnaraju@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: ODT export: Issues with `org-export-footnote-first-reference-p'
Date: Fri, 13 Feb 2015 01:18:03 +0100	[thread overview]
Message-ID: <877fvmvf44.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <54DC2F94.90109@gmail.com> (Vaidheeswaran's message of "Thu, 12 Feb 2015 10:14:04 +0530")

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,

  parent reply	other threads:[~2015-02-13  0:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877fvmvf44.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=vaidheeswaran.chinnaraju@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).