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:20130420T150000 DTEND:20130420T170000 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 (file+olp "~/Documents/philosophy/dissertation/tasks.org" "Bookmarks") (file "~/org/templates/bookmark-school.txt")) ("l" "Life") ("lt" "Todo" entry (file+headline "~/org/life.org" "Tasks") (file "~/org/templates/todo.txt") :prepend t) ("ly" "Todo (from active region or kill ring)" entry (file+headline "~/org/life.org" "Tasks") (file "~/org/templates/todo-with-yank.txt") :prepend t) ("ll" "Todo (with link)" entry (file+headline "~/org/life.org" "Tasks") (file "~/org/templates/todo-with-link.txt") :prepend t) ("le" "Event" entry (file+headline "~/org/life.org" "Events") (file "~/org/templates/event.txt") :prepend t) ("la" "Appointment" entry (file+headline "~/org/life.org" "Tasks") (file "~/org/templates/appointment.txt") :prepend t) ("lr" "Reading" entry (file+headline "~/org/life.org" "Reading list") (file "~/org/templates/reading-life.txt")) ("lb" "Bookmark" entry (file+olp "~/org/life.org" "Bookmarks" "Misc.") (file "~/org/templates/bookmark-life.txt")) ("l$" "Bill" entry (file+olp "~/org/life.org" "Finances" "Bills") (file "~/org/templates/bill.txt") :prepend t) ("f" "Food") ("fr" "Recipe" entry (file+headline "~/org/food.org" "Recipes") (file "~/org/templates/recipe.txt") :prepend t) ("c" "Contacts") ("cp" "Personal" entry (file "~/org/contacts.org") (file "~/org/templates/contact-personal.txt")) ("cs" "School" entry (file "~/org/contacts.org") (file "~/org/templates/contact-school.txt")) ("co" "Organization" entry (file "~/org/contacts.org") (file "~/org/templates/contact-organization.txt")) ("a" "[Automated]") ("ap" "100 Paper" entry (file+olp "~/Documents/philosophy/teaching/100/papers/papers.org" "New") (file "~/org/templates/paper-100.txt")) ) org-after-todo-state-change-hook '(org-clock-out-if-current) org-combined-agenda-icalendar-file "~/Documents/website/public_html/lib/attachments/calendar.ics" org-icalendar-timezone "America/Los_Angeles" org-footnote-auto-label 'confirm org-list-empty-line-terminates-plain-lists t org-agenda-sorting-strategy '((agenda time-up deadline-up priority-down todo-state-up category-keep) (todo time-down priority-down category-keep) (tags tag-down priority-down category-keep) (search time-up priority-down todo-state-up)) org-export-with-drawers '(not "LOGBOOK") org-export-copy-to-kill-ring 'if-interactive org-capture-before-finalize-hook '((lambda nil (add-bibliographic-data))) org-export-preprocess-hook '(ignoreheading-org-export-preprocess-hook) org-tab-first-hook '(org-hide-block-toggle-maybe org-src-native-tab-command-maybe org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-confirm-shell-link-function 'yes-or-no-p org-todo-keywords '((sequence "TODO" "INPROGRESS" "WAITING" "|" "DONE" "CANCELED") (sequence "FIND" "PRINT" "READ" "NOTES" "|" "DONE" "CANCELED") (sequence "PRIMARY" "SECONDARY" "|" "BOTTLED")) org-agenda-before-write-hook '(org-agenda-add-entry-text) org-babel-pre-tangle-hook '(save-buffer) org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-hide-inline-tasks org-cycle-show-empty-lines org-optimize-window-after-visibility-change) org-publish-project-alist '(("orgfiles" :base-directory "~/Documents/website/src" :publishing-directory "~/Documents/website/public_html" :publishing-function org-publish-org-to-html :base-extension "org$") ("css" :base-directory "~/Documents/website/src/lib/css" :publishing-directory "~/Documents/website/public_html/lib/css" :publishing-function org-publish-attachment :base-extension "css$") ("images" :base-directory "~/Documents/website/src/lib/img" :publishing-directory "~/Documents/website/public_html/lib/img" :publishing-function org-publish-attachment :base-extension "png\\|jpe?g") ("12aworksheets-build" :base-directory "~/Documents/philosophy/teaching/12A/worksheets" :publishing-directory "~/Documents/philosophy/teaching/12A/worksheets" :publishing-function org-publish-org-to-pdf :base-extension "xxxx" :include ("worksheets.org")) ("12aworksheets-attach" :base-directory "~/Documents/philosophy/teaching/12A/worksheets" :publishing-directory "~/Documents/website/public_html/lib/attachments/teaching/12A" :publishing-function org-publish-attachment :base-extension "pdf") ("12asyllabus-build" :base-directory "~/Documents/philosophy/teaching/12A/syllabus" :publishing-directory "~/Documents/philosophy/teaching/12A/syllabus" :publishing-function org-publish-org-to-pdf :base-extension "xxxx" :include ("section-syllabus.org")) ("12asyllabus-attach" :base-directory "~/Documents/philosophy/teaching/12A/syllabus" :publishing-directory "~/Documents/website/public_html/lib/attachments/teaching/12A" :publishing-function org-publish-attachment :base-extension "pdf") ("12apdfs" :components ("12aworksheets-build" "12aworksheets-attach" "12asyllabus-build" "12asyllabus-attach")) ("25asyllabus-build" :base-directory "~/Documents/philosophy/teaching/25A/syllabus" :publishing-directory "~/Documents/philosophy/teaching/25A/syllabus" :publishing-function org-publish-org-to-pdf :base-extension "xxxx" :include ("section-syllabus.org")) ("25asyllabus-attach" :base-directory "~/Documents/philosophy/teaching/25A/syllabus" :publishing-directory "~/Documents/website/public_html/lib/attachments/teaching/25A" :publishing-function org-publish-attachment :base-extension "pdf") ("25ahandouts-attach" :base-directory "~/Documents/philosophy/teaching/25A/handouts" :publishing-directory "~/Documents/website/public_html/lib/attachments/teaching/25A" :publishing-function org-publish-attachment :base-extension "pdf") ("25apdfs" :components ("25asyllabus-build" "25asyllabus-attach" "25ahandouts-attach")) ("100pdfs-build" :base-directory "~/Documents/philosophy/teaching/100" :publishing-directory "~/Documents/philosophy/teaching/100" :publishing-function org-publish-org-to-pdf :base-extension "xxxx" :include ("syllabus.org" "paper-guidelines.org")) ("100pdfs-attach" :base-directory "~/Documents/philosophy/teaching/100" :publishing-directory "~/Documents/website/public_html/lib/attachments/teaching/100" :publishing-function org-publish-attachment :base-extension "pdf") ("100pdfs" :components ("100pdfs-build" "100pdfs-attach")) ("146syllabus-build" :base-directory "~/Documents/philosophy/teaching/146/syllabus" :publishing-directory "~/Documents/philosophy/teaching/146/syllabus" :publishing-function org-publish-org-to-pdf :base-extension "xxxx" :include ("section-syllabus.org")) ("146syllabus-attach" :base-directory "~/Documents/philosophy/teaching/146/syllabus" :publishing-directory "~/Documents/website/public_html/lib/attachments/teaching/146" :publishing-function org-publish-attachment :base-extension "pdf") ("146handouts-attach" :base-directory "~/Documents/philosophy/teaching/146/handouts" :publishing-directory "~/Documents/website/public_html/lib/attachments/teaching/146" :publishing-function org-publish-attachment :base-extension "pdf") ("146pdfs" :components ("146syllabus-build" "146syllabus-attach")) ("website" :components ("orgfiles" "css" "images" "146pdfs"))) org-export-with-tags t org-agenda-span 1 org-mode-hook '(#[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook org-show-block-all append local] 5] #[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes) org-refile-targets '((nil :maxlevel . 4)) org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe) org-confirm-elisp-link-function 'yes-or-no-p org-refile-use-outline-path t org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-occur-hook '(org-first-headline-recenter) org-from-is-user-regexp "\\<Richard Lawrence\\>" org-icalendar-include-body t org-icalendar-combined-description "" org-mobile-directory "/media/nexus/mobileorg" org-agenda-cmp-user-defined 'org-agenda-cmp-by-deadline org-modules '(org-habit org-w3m org-bbdb org-bibtex org-docview org-gnus org-info org-irc org-mhe org-rmail) org-latex-format-headline-function 'org-latex-format-headline-default-function org-metadown-hook '(org-babel-pop-to-session-maybe) )
[-- Attachment #1: Type: text/plain, Size: 681 bytes --] Hi Richard, 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. I did not look further, surely Nicolas has something that works. I agree footnotes should be turned off by default for the .ics export. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: ox-icalendar.el.patch --] [-- Type: text/x-patch, Size: 570 bytes --] 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 [-- Attachment #3: Type: text/plain, Size: 14 bytes --] -- Bastien
[-- 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. Best, Richard [-- 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)) :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.
[-- Attachment #1: Type: text/plain, Size: 726 bytes --] Here is a patch for a couple of tiny issues I encountered in ox-ascii.el while debugging ox-icalendar.el. Explanation: 1) There is no function called `org-ascii-footnote-definition' (though it looks like maybe there once was?), so I changed a reference to it to `ignore' to be more explicit. I'm not sure if this is the right thing to do -- maybe the point was to let the user define such a function if she wishes? That however would be inconsistent with the comment that such definitions are ignored (see below). 2) A tiny change to the comment explaining why there is no such function: footnote definitions are ignored because they are compiled by `org-ascii-inner-template', not `org-ascii-template'. Best, Richard [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: ox-ascii.el.patch --] [-- Type: text/x-diff, Size: 829 bytes --] diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el index 2191539..4543c34 100644 --- a/lisp/ox-ascii.el +++ b/lisp/ox-ascii.el @@ -68,7 +68,7 @@ (export-block . org-ascii-export-block) (export-snippet . org-ascii-export-snippet) (fixed-width . org-ascii-fixed-width) - (footnote-definition . org-ascii-footnote-definition) + (footnote-definition . ignore) (footnote-reference . org-ascii-footnote-reference) (headline . org-ascii-headline) (horizontal-rule . org-ascii-horizontal-rule) @@ -1147,7 +1147,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." ;;;; Footnote Definition ;; Footnote Definitions are ignored. They are compiled at the end of -;; the document, by `org-ascii-template'. +;; the document, by `org-ascii-inner-template'. ;;;; Footnote Reference
Hello,
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).
>
> 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
Hello,
Bastien <bzg@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
Richard Lawrence <richard.lawrence@berkeley.edu> writes:
> Here is a patch for a couple of tiny issues I encountered in ox-ascii.el
> while debugging ox-icalendar.el. Explanation:
I applied the changes. Thank you.
Regards,
--
Nicolas Goaziou
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> I went a bit further. Footnotes will always be ignored in ics
> export.
Great, thanks!
--
Bastien