From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jambunathan K Subject: Re: empty footnotes in ODT export Date: Fri, 03 Feb 2012 00:14:26 +0530 Message-ID: <8139atyt11.fsf@gmail.com> References: <87ehud5wt1.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:49719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt1ej-0001lY-HE for emacs-orgmode@gnu.org; Thu, 02 Feb 2012 13:45:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rt1ed-0002HZ-Ec for emacs-orgmode@gnu.org; Thu, 02 Feb 2012 13:45:13 -0500 Received: from mail-pw0-f41.google.com ([209.85.160.41]:36758) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt1ed-0002H6-3i for emacs-orgmode@gnu.org; Thu, 02 Feb 2012 13:45:07 -0500 Received: by pbaa12 with SMTP id a12so2533097pba.0 for ; Thu, 02 Feb 2012 10:45:06 -0800 (PST) In-Reply-To: <87ehud5wt1.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Thu, 02 Feb 2012 18:55:38 +0800") 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: Eric Abrahamsen Cc: Nicolas Goaziou , emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eric Abrahamsen writes: > I've started using the ODT exporter, which is great except that files > with footnotes export empty footnotes: the in-text links and footnote > sections at the bottom of the pages are in place, but the text of the > footnote itself is empty. > > I can't think of anything special about my org file setup, including how > I use footnotes, or how I export. I have no `org-footnote-section' set, > so the footnotes collect at the bottom of each section. I thought it > might be because the file I'm working on now has a lot of Chinese in the > footnotes, but this happens with all my files. I'm just using the 'o' > key from the export dispatcher. > > Umm=E2=80=A6 I can't think of anything else. Can I provide any more info?= Anyone > else seeing this? Eric Next time, please provide an example org file and possible settings for reproducing the bug. Nicolas Fix is in your court. Here is my analysis. Read on .... Disable footnote section. #+begin_src emacs-lisp (setq org-footnote-section nil)=20 #+end_src Install this advice. (defadvice org-export-preprocess-string (after my-org-export-preprocess-string activate) "Org buffer as seen by ODT exporter." (message "---- BEGIN ---") (message "%s" ad-return-value) (message "---- END ---") ad-return-value) Export the attached footnote.org. Note that at the end of pre-process footnote definition appear *before* the first footnote reference. ,---- POST-PREPROCESS | ---- BEGIN --- |=20 |=20 |=20 |=20 | * Headline1=20 | See footnote-1[1] |=20 | [1] Footnote defintion-1. |=20 | * Headline 2=20 | See footnote-2[2] |=20 | [2] Footnote definition-2. | [2 times] | ---- END --- `---- Apply the attached path to org-footnote.el. Refer my notes in the patch. (OK, not really a patch. But a hint.) ,---- POST-PREPROCESS | ---- BEGIN --- |=20 | [1] Footnote defintion-1. |=20 | [2] Footnote definition-2. |=20 |=20 |=20 |=20 | * Headline1=20 | See footnote-1[1] |=20 | * Headline 2=20 | See footnote-2[2] | [2 times] | ---- END --- `---- Things are fine now. > Thanks! > Eric --=20 --=-=-= Content-Type: text/x-org Content-Disposition: attachment; filename=footnote.org #+TITLE: footnote.org #+AUTHOR: Jambunathan K #+EMAIL: kjambunathan@gmail.com #+DATE: 2012-02-02 Thu #+DESCRIPTION: #+KEYWORDS: #+LANGUAGE: en #+OPTIONS: H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t #+OPTIONS: TeX:t LaTeX:dvipng skip:nil d:nil todo:t pri:nil tags:not-in-toc #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport #+LINK_UP: #+LINK_HOME: #+XSLT: * Headline1 See footnote-1[fn:1] [fn:1] Footnote defintion-1. * Headline 2 See footnote-2[fn:2] [fn:2] Footnote definition-2. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=org-footnote.el.diff warning: CRLF will be replaced by LF in lisp/org-footnote.el. The file will have its original line endings in your working directory. diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el index a0d6a56..9e1c407 100644 --- a/lisp/org-footnote.el +++ b/lisp/org-footnote.el @@ -769,6 +769,8 @@ Additional note on `org-footnote-insert-pos-for-preprocessor': ref-table) ;; 5. Insert the footnotes again in the buffer, at the ;; appropriate spot. + + ;; cursor is positioned at the insertion point (goto-char ins-point) (cond ;; No footnote: exit. @@ -814,8 +816,17 @@ Additional note on `org-footnote-insert-pos-for-preprocessor': ((not sort-only) (mapc (lambda (x) - (goto-char (nth 4 x)) - (org-footnote-goto-local-insertion-point) + + ;; cursor is moved again. Don't do it - ODT exporter is + ;; unhappy because definitions *follow* the reference. What + ;; needs to happen is that definition *must* precede the + ;; first reference. + + ;; DON' MOVE THE CURSOR + ;; (goto-char (nth 4 x)) + ;; (org-footnote-goto-local-insertion-point) + ;; DON'T MOVE THE CURSOR + (insert (format "\n[%s] %s\n" (nth 1 x) (nth 2 x)))) ref-table)) ;; Else, insert each definition at the end of the section --=-=-=--