aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-01-14 01:09:09 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-02-01 13:20:59 +0100
commitaa9e98374f79ffcc7f017744c22fae67110cdb50 (patch)
treef73515bbcaf75cb878b43037bede0527d52639c6
parentFix small-cal highlight for "remote" dates. (diff)
downloadcalp-aa9e98374f79ffcc7f017744c22fae67110cdb50.tar.gz
calp-aa9e98374f79ffcc7f017744c22fae67110cdb50.tar.xz
Handle types of xcal rrule.
-rw-r--r--module/vcomponent/xcal/parse.scm26
-rw-r--r--tests/recurrence-simple.scm24
2 files changed, 48 insertions, 2 deletions
diff --git a/module/vcomponent/xcal/parse.scm b/module/vcomponent/xcal/parse.scm
index 6ae8c2f9..124a91f4 100644
--- a/module/vcomponent/xcal/parse.scm
+++ b/module/vcomponent/xcal/parse.scm
@@ -58,7 +58,31 @@
((@ (vcomponent recurrence parse)
rfc->datetime-weekday)
(string->symbol v)))
- (else v))))))]
+ ((freq) (string->symbol v))
+ ((until)
+ ;; RFC 6321 (xcal), p. 30 specifies type-until as
+ ;; type-until = element until {
+ ;; type-date |
+ ;; type-date-time
+ ;; }
+ ;; but doesn't bother defining type-date[-time]...
+ ;; This is acknowledged in errata 3315 [1], but
+ ;; it lacks a solution...
+ ;; Seeing as RFC 7265 (jcal) in Example 2 (p. 16)
+ ;; show the date as a direct string we will roll
+ ;; with that here to.
+ ;; [1]: https://www.rfc-editor.org/errata/eid3315
+ (string->date/-time v))
+ ((byday) #|TODO|#
+ (throw 'not-yet-implemented))
+ ((count interval bysecond bymunite byhour
+ bymonthday byyearday byweekno
+ bymonth bysetpos)
+ (string->number v))
+ (else (throw
+ 'key-error
+ "Invalid key ~a, with value ~a"
+ k v)))))))]
[(time) (parse-iso-time (car value))]
diff --git a/tests/recurrence-simple.scm b/tests/recurrence-simple.scm
index 9c78977b..166fa349 100644
--- a/tests/recurrence-simple.scm
+++ b/tests/recurrence-simple.scm
@@ -12,7 +12,8 @@
((guile) format)
((vcomponent) parse-calendar)
- ((vcomponent recurrence)
+ ((vcomponent xcal parse) sxcal->vcomponent)
+ ((vcomponent recurrence)
parse-recurrence-rule
make-recur-rule
generate-recurrence-set))
@@ -238,3 +239,24 @@ END:VCALENDAR"
(test-assert "Changing type on Recurrence id."
(stream->list 10 (generate-recurrence-set ev)))
+
+;;; Earlier I failed to actually parse the recurrence parts, in short, 1 ≠ "1".
+
+(define ev
+ (sxcal->vcomponent
+ '(vevent
+ (properties
+ (summary (text "reptest"))
+ (dtend (date-time "2021-01-13T02:00:00"))
+ (dtstart (date-time "2021-01-13T01:00:00"))
+ (uid (text "RNW198S6QANQPV1C4FDNFH6ER1VZX6KXEYNB"))
+ (rrule (recur (freq "WEEKLY")
+ (interval "1")
+ (wkst "MO")))
+ (dtstamp (date-time "2021-01-13T01:42:20Z"))
+ (sequence (integer "0")))
+ (components))))
+
+(test-assert
+ "Check that recurrence rule commint from xcal also works"
+ (generate-recurrence-set ev))