From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Lawrence 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 Message-ID: <87li8b1ztl.fsf@berkeley.edu> References: <87li8c9a6f.fsf@berkeley.edu> <877gjwowok.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:58313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTzKv-00004w-5W for emacs-orgmode@gnu.org; Sun, 21 Apr 2013 14:50:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UTzKt-0002RX-Pj for emacs-orgmode@gnu.org; Sun, 21 Apr 2013 14:50:05 -0400 Received: from plane.gmane.org ([80.91.229.3]:52105) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTzKt-0002Pb-Jd for emacs-orgmode@gnu.org; Sun, 21 Apr 2013 14:50:03 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UTzKr-0005Nr-Ll for emacs-orgmode@gnu.org; Sun, 21 Apr 2013 20:50:01 +0200 Received: from c-67-164-33-170.hsd1.ca.comcast.net ([67.164.33.170]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 21 Apr 2013 20:50:01 +0200 Received: from richard.lawrence by c-67-164-33-170.hsd1.ca.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 21 Apr 2013 20:50:01 +0200 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: emacs-orgmode@gnu.org --=-=-= Hi Bastien, Bastien writes: > Richard Lawrence 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. Best, Richard --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=ical-inner-template.patch Content-Description: ignore footnotes in icalendar export 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)) :options-alist '((:exclude-tags @@ -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. --=-=-=--