41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
+
|
web-root
articles-folder
series-folder
images-folder
articles-pagetree
series-pagetree
first-words
normalize
build-note-id
notes->last-disposition-values
disposition-values
)
(define default-authorname "Joel Dueck")
(define series-folder "series")
|
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
+
+
+
+
+
+
|
(check-equal? (first-words txs-decimals 5) "Four score and 7.8 years")
(check-equal? (first-words txs-punc+split-elems 5) "Stop! she called. She was")
(check-equal? (first-words txs-dashes 5) "One and only one. That")
(check-equal? (first-words txs-dashes 4) "One and only one.")
(check-equal? (first-words txs-parens-commas 5) "She counted one two silently")
(check-equal? (first-words txs-short 5) "Not much here!"))
;; Convert a string into all lowercase, replace all non-alphanum chars with ‘-’
(define (normalize str)
(~> (regexp-replace* #rx"[^A-Za-z0-9 ]" str "")
string-downcase
(string-normalize-spaces #px"\\s+" "-")))
;; Convert, e.g., "* thoroughly recanted" into (values "*" "thoroughly recanted")
(define (disposition-values str)
(cond [(string=? "" str) (values "" "")]
[else (let ([splut (string-split str)])
(values (car splut) (string-join (cdr splut))))]))
|