Function: icalendar--convert-anniversary-to-ical
icalendar--convert-anniversary-to-ical is a byte-compiled function
defined in icalendar.el.gz.
Signature
(icalendar--convert-anniversary-to-ical NONMARKER ENTRY-MAIN)
Documentation
Convert diary-anniversary diary entry to iCalendar format.
NONMARKER is a regular expression matching the start of non-marking entries. ENTRY-MAIN is the first line of the diary entry.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/icalendar.el.gz
(defun icalendar--convert-anniversary-to-ical (nonmarker entry-main)
"Convert `diary-anniversary' diary entry to iCalendar format.
NONMARKER is a regular expression matching the start of non-marking
entries. ENTRY-MAIN is the first line of the diary entry."
(if (string-match (concat nonmarker
"%%(diary-anniversary \\([^)]+\\))\\s-*"
"\\(\\([0-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?"
"\\("
"-\\([0-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?"
"\\)?"
"\\s-*\\(.*?\\) ?$")
entry-main)
(let* ((datetime (substring entry-main (match-beginning 1)
(match-end 1)))
(startisostring (icalendar--datestring-to-isodate
datetime nil 1))
(endisostring (icalendar--datestring-to-isodate
datetime 1 1))
(starttimestring (icalendar--diarytime-to-isotime
(if (match-beginning 3)
(substring entry-main
(match-beginning 3)
(match-end 3))
nil)
(if (match-beginning 4)
(substring entry-main
(match-beginning 4)
(match-end 4))
nil)))
(endtimestring (icalendar--diarytime-to-isotime
(if (match-beginning 6)
(substring entry-main
(match-beginning 6)
(match-end 6))
nil)
(if (match-beginning 7)
(substring entry-main
(match-beginning 7)
(match-end 7))
nil)))
(summary (icalendar--convert-string-for-export
(substring entry-main (match-beginning 8)
(match-end 8)))))
(icalendar--dmsg "diary-anniversary %s" entry-main)
(when starttimestring
(unless endtimestring
(let ((time
(read (replace-regexp-in-string "^T0?" ""
starttimestring))))
(setq endtimestring (format "T%06d"
(+ 10000 time))))))
(cons (concat "\nDTSTART;"
(if starttimestring "VALUE=DATE-TIME:"
"VALUE=DATE:")
startisostring
(or starttimestring "")
"\nDTEND;"
(if endtimestring "VALUE=DATE-TIME:"
"VALUE=DATE:")
endisostring
(or endtimestring "")
"\nRRULE:FREQ=YEARLY;INTERVAL=1"
;; the following is redundant,
;; but korganizer seems to expect this... ;(
;; and evolution doesn't understand it... :(
;; so... who is wrong?!
";BYMONTH="
(substring startisostring 4 6)
";BYMONTHDAY="
(substring startisostring 6 8))
summary))
;; no match
nil))