Re: [O] Bug: Footnotes break iCalendar export [8.0.1 (release_8.0.1 @ /home/rwl/src/org-mode/lisp/)]

2013-04-21 Thread Bastien
Hi Richard,

Richard Lawrence richard.lawre...@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.

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

diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index 49299b0..ceb2df0 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -266,6 +266,7 @@ re-read the iCalendar file.)
   '((:exclude-tags
  ICALENDAR_EXCLUDE_TAGS nil org-icalendar-exclude-tags split)
 (:with-timestamps nil  org-icalendar-with-timestamps)
+(:with-footnotes nil f nil)
 (:with-vtodo nil nil org-icalendar-include-todo)
 ;; The following property will be non-nil when export has been
 ;; started from org-agenda-mode.  In this case, any entry without

-- 
 Bastien


Re: [O] Bug: Footnotes break iCalendar export [8.0.1 (release_8.0.1 @ /home/rwl/src/org-mode/lisp/)]

2013-04-21 Thread Richard Lawrence
Hi Bastien,

Bastien b...@gnu.org writes:

 Richard Lawrence richard.lawre...@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.

Best,
Richard

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.


Re: [O] Bug: Footnotes break iCalendar export [8.0.1 (release_8.0.1 @ /home/rwl/src/org-mode/lisp/)]

2013-04-21 Thread Nicolas Goaziou
Hello,

Richard Lawrence richard.lawre...@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).

 Here's a sample Org file to illustrate:

 * Entry 1
   This entry has some text with an inline footnote[fn:: which isn't
   very interesting]
 * Entry 2
   This entry has some text with an external footnote[fn:1]
 * Appointment with Someone
   2013-04-20 Sat 15:00
 * Footnotes
 [fn:1] which still isn't very interesting

This should be fixed. Thank you for the report.


Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Footnotes break iCalendar export [8.0.1 (release_8.0.1 @ /home/rwl/src/org-mode/lisp/)]

2013-04-21 Thread Nicolas Goaziou
Hello,

Bastien b...@gnu.org 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.

 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 went a bit further. Footnotes will always be ignored in ics export.


Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Footnotes break iCalendar export [8.0.1 (release_8.0.1 @ /home/rwl/src/org-mode/lisp/)]

2013-04-21 Thread Bastien
Nicolas Goaziou n.goaz...@gmail.com writes:

 I went a bit further. Footnotes will always be ignored in ics
 export.

Great, thanks!

-- 
 Bastien



[O] Bug: Footnotes break iCalendar export [8.0.1 (release_8.0.1 @ /home/rwl/src/org-mode/lisp/)]

2013-04-20 Thread Richard Lawrence

Hi Org maintainers,

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

Here's a sample Org file to illustrate:

* Entry 1
  This entry has some text with an inline footnote[fn:: which isn't
  very interesting]
* Entry 2
  This entry has some text with an external footnote[fn:1]
* Appointment with Someone
  2013-04-20 Sat 15:00
* Footnotes
[fn:1] which still isn't very interesting

And here's the output I get when I export this
(via C-c a  a C-x C-w /tmp/test.ics):

BEGIN:VCALENDAR
VERSION:2.0
X-WR-CALNAME:OrgMode
PRODID:-//Richard Lawrence//Emacs with Org mode//EN
X-WR-TIMEZONE:America/Los_Angeles
X-WR-CALDESC:
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTAMP:20130420T211153Z
UID:TS1-5b8f14ac-d380-437f-88dd-4ed0a4ebacb9
DTSTART:20130420T15
DTEND:20130420T17
SUMMARY:Appointment with Someone
DESCRIPTION:2013-04-20 Sat 15:00
CATEGORIES:test
END:VEVENT



Footnotes
─

[1] which isn't very interesting

[2] which still isn't very interesting
END:VCALENDAR

Note that I still seem to get the behavior when I restrict the export to
headlines matching certain tags.  In that case, even footnotes from
entries which should not be exported end up in the output, which seems
pretty strange.

It doesn't make much sense to me to have footnotes when exporting to a
calendar format, so is there any way to suppress exporting footnotes in
this case?

Thanks!

Best,
Richard



Emacs  : GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2013-01-08 on murphy, modified by Debian
Package: Org-mode version 8.0.1 (release_8.0.1 @ /home/rwl/src/org-mode/lisp/)

current state:
==
(setq
 org-todo-keyword-faces '((WAITING . orange))
 org-speed-command-hook '(org-speed-command-default-hook 
org-babel-speed-command-hook)
 org-agenda-custom-commands '((r Reading list tags-todo +reading) (S . 
STUDY context searches) (Sf todo FIND) (Sp todo PRINT)
  (Sr todo READ) (Sn todo NOTES) (St 
tags-todo +STUDY) (P tags-todo +CAMPUS) (D tags-todo +COMPUTER)
  (H tags-todo +HOME) (E tags-todo 
ERRAND|BUY) (F tags +FREETIME) (X tags-todo +EXERCISE)
  (Z Export to iCalendar file tags 
event|appointment nil 
(~/Documents/website/public_html/lib/attachments/calendar.ics))
  )
 org-agenda-files '(~/Documents/philosophy/dissertation/tasks.org 
~/org/school.org ~/org/life.org ~/org/beer.org ~/org/food.org)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-capture-templates '((s School)
 (st Todo entry (file+olp ~/org/school.org 
Tasks Spring 2013) (file ~/org/templates/todo.txt) :prepend t)
 (sy Todo (from active region or kill ring) entry 
(file+olp ~/org/school.org Tasks Spring 2013)
  (file ~/org/templates/todo-with-yank.txt) :prepend 
t)
 (sl Todo (with link) entry (file+olp 
~/org/school.org Tasks Spring 2013) (file 
~/org/templates/todo-with-link.txt)
  :prepend t)
 (se Event entry (file+headline ~/org/school.org 
Events) (file ~/org/templates/event.txt) :prepend t)
 (sr Reading entry (file+olp ~/org/school.org 
Reading list) (file ~/org/templates/reading.txt) :prepend t)
 (sa Appointment entry (file+olp ~/org/school.org 
Tasks Spring 2013) (file ~/org/templates/appointment.txt) :prepend t)
 (sb Bookmark entry (file+olp ~/org/school.org 
Bookmarks) (file ~/org/templates/bookmark-school.txt))
 (sc Class entry (file+olp ~/org/school.org 
Semester Schedule Spring 2013 Classes) (file ~/org/templates/class.txt))
 (ss Semester entry (file+olp ~/org/school.org 
Semester Schedule) (file ~/org/templates/semester.txt) :prepend t)
 (d Dissertation)
 (dt Todo entry (file+olp 
~/Documents/philosophy/dissertation/tasks.org Tasks) (file 
~/org/templates/todo.txt) :prepend t)
 (de Event entry (file+headline 
~/Documents/philosophy/dissertation/tasks.org Events) (file 
~/org/templates/event.txt)
  :prepend t)
 (dr Reading entry (file+olp 
~/Documents/philosophy/dissertation/tasks.org Reading list)
  (file ~/org/templates/reading.txt) :prepend t)
 (da Appointment entry (file+olp 
~/Documents/philosophy/dissertation/tasks.org Tasks)
  (file ~/org/templates/appointment.txt) :prepend t)
 (db Bookmark entry