Function: icalendar-parse-from-string

icalendar-parse-from-string is a byte-compiled function defined in icalendar-parser.el.gz.

Signature

(icalendar-parse-from-string TYPE S)

Documentation

Parse string S to an iCalendar syntax node of type TYPE.

S should not contain folded content lines.

Other relevant functions are documented in the icalendar group.

Shortdoc

;; icalendar
(icalendar-parse-from-string 'icalendar-rrule "RRULE:FREQ=WEEKLY\n")
    => (icalendar-rrule ...)

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/icalendar-parser.el.gz
;;;; Some utilities:
(defun ical:parse-from-string (type s)
  "Parse string S to an iCalendar syntax node of type TYPE.
S should not contain folded content lines."
  ;; TODO: support unfolding?
  (with-temp-buffer
    (insert s)
    (goto-char (point-min))
    (cond ((ical:component-type-symbol-p type)
           (ical:parse-component (point-max)))
          ((ical:property-type-symbol-p type)
           (ical:parse-property (point-max)))
          ((ical:param-type-symbol-p type)
           (unless (looking-at-p ";")
             (insert ";")
             (backward-char))
           (ical:parse-params (point-max)))
          ((ical:value-type-symbol-p type)
           (ical:parse-value-node type (point-max)))
          (t
           (error "Don't know how to parse type %s" type)))))