Function: icalendar-vcalendar-validator
icalendar-vcalendar-validator is a byte-compiled function defined in
icalendar-parser.el.gz.
Signature
(icalendar-vcalendar-validator NODE)
Documentation
Additional validator for icalendar-vcalendar NODE.
Checks that NODE has at least one component child and that all of the
ical-tzidparam values appearing in subcomponents have a corresponding
icalendar-vtimezone definition.
This function is called by icalendar-ast-node-valid-p for
VCALENDAR nodes; it is not normally necessary to call it directly.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/icalendar-parser.el.gz
(defun ical:vcalendar-validator (node)
"Additional validator for `icalendar-vcalendar' NODE.
Checks that NODE has at least one component child and that all of the
`ical-tzidparam' values appearing in subcomponents have a corresponding
`icalendar-vtimezone' definition.
This function is called by `icalendar-ast-node-valid-p' for
VCALENDAR nodes; it is not normally necessary to call it directly."
(let* ((children (ical:ast-node-children node))
(comp-children (seq-filter #'ical:component-node-p children))
(tz-children (seq-filter #'ical:vtimezone-component-p children))
(defined-tzs
(mapcar
(lambda (tz)
;; ensure vtimezone component has a TZID property and
;; extract its string value:
(when (ical:ast-node-valid-p tz)
(ical:with-component tz ((ical:tzid :value-node tzid-text))
(ical:text-to-string tzid-text))))
tz-children))
(appearing-tzids (ical:all-tzidparams-in node)))
(unless comp-children
(ical:signal-validation-error
"`icalendar-vcalendar' must contain at least one component"
:node node))
(let ((seen nil))
(dolist (tzid appearing-tzids)
(unless (member tzid seen)
(unless (member tzid defined-tzs)
(ical:signal-validation-error
(format "No `icalendar-vtimezone' with TZID '%s' in calendar" tzid)
:node node)))
(push tzid seen)))
;; success:
node))