40
41
42
43
44
45
46
47
48
49
|
40
41
42
43
44
45
46
47
48
49
50
|
+
|
ymd->english
ymd->dateformat
default-authorname
default-title
tx-strs
first-words
build-note-id
notes->last-disposition-values
)
(define default-authorname "Joel Dueck")
|
80
81
82
83
84
85
86
87
88
89
|
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
+
+
+
+
+
+
+
|
(cond
[(txexpr? xpr) (apply string-append (map tx-strs (get-elements xpr)))]
[(string? xpr) xpr]
[else ""]))
(define (first-words str n)
(define trunc
(apply string-append
(add-between (take (string-split str) n) " ")))
;; Remove trailing punctuation (commas, etc.)
(regexp-replace #px"\\W+$" trunc ""))
(module+ test
(require rackunit)
(define test-metas (hash 'name "Fiver" 'size "Small"))
(define test-attrs '([name "Hazel"] [rank "Chief"]))
|