emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Richard Lawrence <richard.lawrence@berkeley.edu>
To: emacs-orgmode@gnu.org
Subject: Re: Bug: Footnotes break iCalendar export [8.0.1 (release_8.0.1 @ /home/rwl/src/org-mode/lisp/)]
Date: Sun, 21 Apr 2013 11:52:22 -0700	[thread overview]
Message-ID: <87li8b1ztl.fsf@berkeley.edu> (raw)
In-Reply-To: 877gjwowok.fsf@bzg.ath.cx

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

Hi Bastien,

Bastien <bzg@gnu.org> writes:

> Richard Lawrence <richard.lawrence@berkeley.edu> writes:
>> I've been trying to get iCalendar export working with my agenda files
>> again since upgrading to 8.0, and I've found that footnotes break the
>> agenda export to .ics.  The problem is that a plain text version of the
>> footnotes in the file ends up in the output "floating loose"---not
>> wrapped by VEVENT tags or any other tags---resulting in an unparseable
>> .ics file (at least according to Google Calendar).
> I tried this patch but for some reason it does not work.

This patch does not work for me, either, but thanks for trying!

> I did not look further, surely Nicolas has something that
> works.  I agree footnotes should be turned off by default
> for the .ics export.

I also tried the following modifications in the definition of the
icalendar backend, without much effect:

1) Adding (footnote-definition . ignore) and
(footnote-reference . ignore) to the :translate-alist

2) Adding (:filter-footnote-definition . ignore) and
(:filter-footnote-reference . ignore) to the :filters-alist

Both of these looked like they might work based on the
org-export-define-backend documentation, but the footnotes still show up
in the output.

[...further tinkering...]

It looks like the problem is this: the icalendar backend does not
specify a transcoder for the "inner-template" element.  Thus it falls
back to the org-ascii-inner-template transcoder, which appends footnotes
to the end of the exported content.

Thus, one solution is to define an org-icalendar-inner-template
transcoder which does nothing to modify the content (but overrides the
fallback); that is the solution I've used in the attached patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ignore footnotes in icalendar export --]
[-- Type: text/x-diff, Size: 1110 bytes --]

diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index 49299b0..39ba383 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -261,6 +261,7 @@ re-read the iCalendar file.")
 		     (inlinetask . ignore)
 		     (planning . ignore)
 		     (section . ignore)
+		     (inner-template . org-icalendar-inner-template)
 		     (template . org-icalendar-template))
@@ -747,7 +748,18 @@ END:VALARM\n"
 		 (if (zerop alarm-time) org-icalendar-alarm-time alarm-time)))))
-;;;; Template
+;;;; Templates
+(defun org-icalendar-inner-template (contents info)
+  "Return inner contents string after iCalendar conversion.
+CONTENTS is the transcoded contents string. INFO is a plist used
+as a communication channel.
+This function just returns CONTENTS unchanged.  Its purpose is to
+override the inner-template transcoder of the ascii
+backend (`org-ascii-inner-template'), which appends footnotes
+that break the iCalendar format."
+  contents)
 (defun org-icalendar-template (contents info)
   "Return complete document string after iCalendar conversion.

  reply	other threads:[~2013-04-21 18:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-20 21:14 Bug: Footnotes break iCalendar export [8.0.1 (release_8.0.1 @ /home/rwl/src/org-mode/lisp/)] Richard Lawrence
2013-04-21 13:11 ` Bastien
2013-04-21 18:52   ` Richard Lawrence [this message]
2013-04-21 19:12   ` [PATCH] tiny fixes in ox-ascii.el [was: Re: Bug: Footnotes break iCalendar export] Richard Lawrence
2013-04-21 21:53     ` Nicolas Goaziou
2013-04-21 21:49   ` Bug: Footnotes break iCalendar export [8.0.1 (release_8.0.1 @ /home/rwl/src/org-mode/lisp/)] Nicolas Goaziou
2013-04-21 22:12     ` Bastien
2013-04-21 21:48 ` 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:

  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=87li8b1ztl.fsf@berkeley.edu \
    --to=richard.lawrence@berkeley.edu \
    --cc=emacs-orgmode@gnu.org \


* 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


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