aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-05-24 17:30:29 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-05-24 19:18:12 +0200
commit05be4a61ddfde13ea4f01dca29877992c7b4f965 (patch)
tree9c0beea7529a9fbf3bb35c6dd1879060715e663f
parentRemove (vcomponent util). (diff)
downloadcalp-05be4a61ddfde13ea4f01dca29877992c7b4f965.tar.gz
calp-05be4a61ddfde13ea4f01dca29877992c7b4f965.tar.xz
Minor change.
-rw-r--r--module/datetime/util.scm13
-rw-r--r--module/entry-points/server.scm2
-rw-r--r--module/util.scm30
-rw-r--r--module/vcomponent/control.scm2
4 files changed, 21 insertions, 26 deletions
diff --git a/module/datetime/util.scm b/module/datetime/util.scm
index 4f461591..1bbde87d 100644
--- a/module/datetime/util.scm
+++ b/module/datetime/util.scm
@@ -175,9 +175,6 @@
((#\k) (format #t "~2' d" (hour time)))
((#\M) (format #t "~2'0d" (minute time)))
((#\S) (format #t "~2'0d" (second time)))
- ;; TODO
- ;; +02:00, get from zoneinfo database
- ;; ((#\z) (when (utc? time) (display "Z")))
((#\Y) (format #t "~4'0d" (year date)))
((#\m) (format #t "~2'0d" (month date)))
((#\d) (format #t "~2'0d" (day date)))
@@ -284,11 +281,13 @@
;; 16 17 18 19 20 21 22
;; 23 24 25 26 27 28 29
;; 30 31
+;; @lisp
;; (month-days #2020-03-01 mon)
-;; => (2020-02-24 ... 2020-02-29)
-;; => (2020-03-01 ... 2020-03-31)
-;; => (2020-04-01 ... 2020-04-05)
-;; TODO Currently givining a non-start-of-month date for @var{date} is an error.
+;; ; ⇒ (2020-02-24 ... 2020-02-29)
+;; ; ⇒ (2020-03-01 ... 2020-03-31)
+;; ; ⇒ (2020-04-01 ... 2020-04-05)
+;; @end lisp
+;; Ignores day component of @var{date}.
(define*-public (month-days date optional: (week-start (week-start)))
(let* ((month-len (days-in-month date))
(prev-month-len (days-in-month (month- date)))
diff --git a/module/entry-points/server.scm b/module/entry-points/server.scm
index c671867d..ceefc5b9 100644
--- a/module/entry-points/server.scm
+++ b/module/entry-points/server.scm
@@ -113,7 +113,7 @@
(define location
(parse-header 'location
(format #f "/~a/~a.html"
- (or view "month")
+ (or view "week")
(date->string
(cond [date => parse-iso-date]
[else (current-date)])
diff --git a/module/util.scm b/module/util.scm
index 617a2ea6..08152c7c 100644
--- a/module/util.scm
+++ b/module/util.scm
@@ -58,21 +58,19 @@
(begin f ...))]))
-(define-syntax aif
- (lambda (stx)
- (syntax-case stx ()
- [(_ condition true-clause false-clause)
- (with-syntax ((it (datum->syntax stx 'it)))
- #'(let ((it condition))
- (if it true-clause false-clause)))])))
-
-(define-syntax awhen
- (lambda (stx)
- (syntax-case stx ()
- [(_ condition body ...)
- (with-syntax ((it (datum->syntax stx 'it)))
- #'(let ((it condition))
- (when it body ...)))])))
+(define-syntax (aif stx)
+ (syntax-case stx ()
+ [(_ condition true-clause false-clause)
+ (with-syntax ((it (datum->syntax stx 'it)))
+ #'(let ((it condition))
+ (if it true-clause false-clause)))]))
+
+(define-syntax (awhen stx)
+ (syntax-case stx ()
+ [(_ condition body ...)
+ (with-syntax ((it (datum->syntax stx 'it)))
+ #'(let ((it condition))
+ (when it body ...)))]))
#;
(define-macro (awhen pred . body)
@@ -280,7 +278,7 @@
(comperator (get a)
(get b)))))
-;; Sorts the list @var{items}. @em{May} destroy the input list in the process
+;; Sorts the list @var{items}. @emph{May} destroy the input list in the process
(define* (sort*! items comperator #:optional (get identity))
"A sort function more in line with how python's sorted works"
(sort! items (lambda (a b)
diff --git a/module/vcomponent/control.scm b/module/vcomponent/control.scm
index 34a2cf95..b9f7bd19 100644
--- a/module/vcomponent/control.scm
+++ b/module/vcomponent/control.scm
@@ -22,8 +22,6 @@
(set! (attr component key) val))))
keys)))
-;;; TODO with-added-attributes
-
(define-syntax with-replaced-attrs
(syntax-rules ()
[(_ (component (key val) ...)