aboutsummaryrefslogtreecommitdiff
path: root/module/vcomponent/parse
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-05-19 17:06:44 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-05-19 17:06:44 +0200
commita337995a9dbcf1000679f9a2d086def0daa90b66 (patch)
tree5af345c472c5925e29e7aa0a56035141e11fe758 /module/vcomponent/parse
parentFix JS ESC to close popup. (diff)
downloadcalp-a337995a9dbcf1000679f9a2d086def0daa90b66.tar.gz
calp-a337995a9dbcf1000679f9a2d086def0daa90b66.tar.xz
Recurrence rules now always parsed.
Diffstat (limited to 'module/vcomponent/parse')
-rw-r--r--module/vcomponent/parse/component.scm35
1 files changed, 23 insertions, 12 deletions
diff --git a/module/vcomponent/parse/component.scm b/module/vcomponent/parse/component.scm
index bb397f21..f8677a19 100644
--- a/module/vcomponent/parse/component.scm
+++ b/module/vcomponent/parse/component.scm
@@ -111,18 +111,29 @@
;; TODO This is an ugly hack until the rest of the code is updated
;; to work on events without an explicit DTEND attribute.
- (when (and (eq? (type (car stack)) 'VEVENT)
- (not (attr (car stack) 'DTEND)))
- (set! (attr (car stack) 'DTEND)
- (let ((start (attr (car stack) 'DTSTART)))
- ;; p. 54, 3.6.1
- ;; If DTSTART is a date then it's an all
- ;; day event. If DTSTART instead is a
- ;; datetime then the event has a length
- ;; of 0?
- (if (date? start)
- (date+ start (date day: 1))
- (datetime+ start (datetime time: (time hour: 1)))))))
+ (when (eq? (type (car stack)) 'VEVENT)
+ (when (not (attr (car stack) 'DTEND))
+ (set! (attr (car stack) 'DTEND)
+ (let ((start (attr (car stack) 'DTSTART)))
+ ;; p. 54, 3.6.1
+ ;; If DTSTART is a date then it's an all
+ ;; day event. If DTSTART instead is a
+ ;; datetime then the event has a length
+ ;; of 0?
+ (if (date? start)
+ (date+ start (date day: 1))
+ (datetime+ start (datetime time: (time hour: 1)))))))
+
+ ;; This isn't part of the field values since we "need"
+ ;; the type of DTSTART for UNTIL to work.
+ ;; This could however be side steped by auto detecting
+ ;; @type{date}s vs @type{datetime}s in @function{parse-recurrence-rule}.
+ (when (attr (car stack) 'RRULE)
+ (set! (attr (car stack) 'RRULE)
+ ((@ (vcomponent recurrence) parse-recurrence-rule)
+ (attr (car stack) 'RRULE)
+ (if (date? (attr (car stack) 'DTSTART))
+ parse-ics-date parse-ics-datetime)))))
(loop (cdr lst)
(if (null? (cdr stack))