Function: icalendar--convert-yearly-to-ical
icalendar--convert-yearly-to-ical is a byte-compiled function defined
in icalendar.el.gz.
Signature
(icalendar--convert-yearly-to-ical NONMARKER ENTRY-MAIN)
Documentation
Convert yearly 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-yearly-to-ical (nonmarker entry-main)
"Convert yearly 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
(if (eq calendar-date-style 'european)
"\\([0-9]+[0-9]?\\)\\s-+\\([a-z]+\\)\\s-+"
"\\([a-z]+\\)\\s-+\\([0-9]+[0-9]?\\)\\s-+")
"\\*?\\s-*"
"\\(\\([0-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?"
"\\("
"-\\([0-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?"
"\\)?"
"\\s-*\\([^0-9]+.*?\\) ?$" ; must not match years
)
entry-main)
(let* ((daypos (if (eq calendar-date-style 'european) 1 2))
(monpos (if (eq calendar-date-style 'european) 2 1))
(day (read (substring entry-main
(match-beginning daypos)
(match-end daypos))))
(month (icalendar--get-month-number
(substring entry-main
(match-beginning monpos)
(match-end monpos))))
(starttimestring (icalendar--diarytime-to-isotime
(if (match-beginning 4)
(substring entry-main
(match-beginning 4)
(match-end 4))
nil)
(if (match-beginning 5)
(substring entry-main
(match-beginning 5)
(match-end 5))
nil)))
(endtimestring (icalendar--diarytime-to-isotime
(if (match-beginning 7)
(substring entry-main
(match-beginning 7)
(match-end 7))
nil)
(if (match-beginning 8)
(substring entry-main
(match-beginning 8)
(match-end 8))
nil)))
(summary (icalendar--convert-string-for-export
(substring entry-main (match-beginning 9)
(match-end 9)))))
(icalendar--dmsg "yearly %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:")
(format "1900%02d%02d" month day)
(or starttimestring "")
"\nDTEND;"
(if endtimestring "VALUE=DATE-TIME:"
"VALUE=DATE:")
;; end is not included! shift by one day
(icalendar--date-to-isodate
(list month day 1900)
(if endtimestring 0 1))
(or endtimestring "")
"\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH="
(format "%d" month)
";BYMONTHDAY="
(format "%d" day))
summary))
;; no match
nil))