emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: Nicolas Goaziou <n.goaziou@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: empty footnotes in ODT export
Date: Fri, 03 Feb 2012 00:14:26 +0530	[thread overview]
Message-ID: <8139atyt11.fsf@gmail.com> (raw)
In-Reply-To: <87ehud5wt1.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Thu, 02 Feb 2012 18:55:38 +0800")

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

Eric Abrahamsen <eric@ericabrahamsen.net> 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… 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) 
#+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 ---
| 
| 
| 
| 
| *  Headline1 
|   See footnote-1[1]
| 
| [1] Footnote defintion-1.
| 
| *  Headline 2 
|   See footnote-2[2]
| 
| [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 ---
| 
| [1] Footnote defintion-1.
| 
| [2] Footnote definition-2.
| 
| 
| 
| 
| *  Headline1 
|   See footnote-1[1]
| 
| *  Headline 2 
|   See footnote-2[2]
|  [2 times]
| ---- END ---
`----

Things are fine now.

> Thanks!
> Eric

-- 

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: footnote.org --]
[-- Type: text/x-org, Size: 541 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: org-footnote.el.diff --]
[-- Type: text/x-patch, Size: 1299 bytes --]

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

  reply	other threads:[~2012-02-02 18:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-02 10:55 empty footnotes in ODT export Eric Abrahamsen
2012-02-02 18:44 ` Jambunathan K [this message]
2012-02-02 19:44   ` Nicolas Goaziou
2012-02-02 20:02     ` Achim Gratz
2012-02-02 20:33       ` Nicolas Goaziou

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=8139atyt11.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric@ericabrahamsen.net \
    --cc=n.goaziou@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).