From d6304f9b0acd3894fd08fccee75ab47d10f9a64a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 30 Jun 2020 01:45:33 +0200 Subject: Rename attributes => properties, properties => parameters. --- module/output/common.scm | 2 +- module/output/ical.scm | 10 +++++----- module/output/types.scm | 6 +++--- module/output/xcal.scm | 22 +++++++++++----------- 4 files changed, 20 insertions(+), 20 deletions(-) (limited to 'module/output') diff --git a/module/output/common.scm b/module/output/common.scm index 3955442f..0d266d01 100644 --- a/module/output/common.scm +++ b/module/output/common.scm @@ -32,7 +32,7 @@ equal? (lset-union equal? '("dummy") (filter-map - (lambda (vline) (and=> (prop vline 'TZID) car)) + (lambda (vline) (and=> (param vline 'TZID) car)) (filter-map (extract* 'DTSTART) events))) '("dummy" "local"))) diff --git a/module/output/ical.scm b/module/output/ical.scm index 114178c6..de6a351d 100644 --- a/module/output/ical.scm +++ b/module/output/ical.scm @@ -28,7 +28,7 @@ ;; fields which can hold lists need not be considered here, ;; since they are split into multiple vlines when we parse them. (cond - [(and=> (prop vline 'VALUE) string->symbol) => get-writer] + [(and=> (param vline 'VALUE) string->symbol) => get-writer] [(memv key '(COMPLETED DTEND DUE DTSTART RECURRENCE-ID CREATED DTSTAMP LAST-MODIFIED ACKNOWLEDGED EXDATE)) @@ -128,7 +128,7 @@ ";" (symbol->string key) (string-join (map (compose (get-writer 'TEXT) ->string) values) "," 'infix))]) - (properties vline))) + (parameters vline))) ":" (value-format key vline)))) (define-public (component->ical-string component) @@ -150,7 +150,7 @@ [(key vline) (display (vline->string vline)) (display "\r\n")]) - (attributes component)) + (properties component)) (for-each component->ical-string (children component)) (format #t "END:~a\r\n" (type component)) @@ -159,7 +159,7 @@ => (lambda (alts) (hash-map->list (lambda (_ comp) (component->ical-string comp)) alts))])) -;; TODO tzid prop on dtstart vs tz field in datetime object +;; TODO tzid param on dtstart vs tz field in datetime object ;; how do we keep these two in sync? (define (write-event-to-file event calendar-path) (define cal (make-vcomponent 'VCALENDAR)) @@ -170,7 +170,7 @@ (add-child! cal event) - (awhen (prop (attr* event 'DTSTART) 'TZID) + (awhen (param (attr* event 'DTSTART) 'TZID) ;; TODO this is broken (add-child! cal (zoneinfo->vtimezone (getf 'zoneinfo) it))) diff --git a/module/output/types.scm b/module/output/types.scm index 22f3ca5b..e5829ccf 100644 --- a/module/output/types.scm +++ b/module/output/types.scm @@ -16,12 +16,12 @@ (define (write-date _ value) (date->string value "~Y~m~d")) -(define (write-datetime prop value) - (datetime->string (hashq-ref prop 'X-HNH-ORIGINAL value) +(define (write-datetime param value) + (datetime->string (hashq-ref param 'X-HNH-ORIGINAL value) ;; TODO ~Z ? "~Y~m~dT~H~M~S~Z" #; - (let ((tz (and=> (prop vline 'TZID) car))) + (let ((tz (and=> (param vline 'TZID) car))) (when (and tz (string= tz "UTC")) (display #\Z))))) diff --git a/module/output/xcal.scm b/module/output/xcal.scm index b5eda1df..eb244921 100644 --- a/module/output/xcal.scm +++ b/module/output/xcal.scm @@ -17,7 +17,7 @@ (define writer (cond - [(and=> (prop vline 'VALUE) (compose string->symbol car)) + [(and=> (param vline 'VALUE) (compose string->symbol car)) => get-writer] [(memv key '(COMPLETED DTEND DUE DTSTART RECURRENCE-ID CREATED DTSTAMP LAST-MODIFIED @@ -87,13 +87,13 @@ values)))) ;; ((key value ...) ...) -> `(parameters , ... ) -(define (parameters-tag properties) - (define outprops (filter-map - (lambda (x) (apply property->value-tag x)) - properties)) +(define (parameters-tag parameters) + (define outparams (filter-map + (lambda (x) (apply property->value-tag x)) + parameters)) - (unless (null? outprops) - `(parameters ,@outprops))) + (unless (null? outparams) + `(parameters ,@outparams))) (define-public (vcomponent->sxcal component) @@ -103,7 +103,7 @@ (remove null? `(,tagsymb ;; TODO only have when it's non-empty. - ;; This becomes MUCH easier once attributes stop returning + ;; This becomes MUCH easier once properties stop returning ;; a hash-map... (properties ,@(filter @@ -116,16 +116,16 @@ (remove null? `(,(downcase-symbol key) ,(parameters-tag (reduce assq-merge - '() (map properties vlines))) + '() (map parameters vlines))) ,@(for vline in vlines (vline->value-tag vline))))] [(key vline) (remove null? `(,(downcase-symbol key) - ,(parameters-tag (properties vline)) + ,(parameters-tag (parameters vline)) ,(vline->value-tag vline)))]) - (attributes component)))) + (properties component)))) ,(unless (null? (children component)) `(components ,@(map vcomponent->sxcal (children component))))))) -- cgit v1.2.3