65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
+
+
+
+
-
+
+
+
+
+
|
@defproc[(tx-strs [tx txexpr?]) string?]
Finds all the strings from the @emph{elements} of @racket[_tx] (ignoring attributes) and concatenates them together.
@examples[#:eval dust-eval
(tx-strs '(p [[class "intro"]]
(em "I’m not opening the safe") ", Wilson remembers thinking."))]
@defproc[(first-words [str string?] [n exact-nonnegative-integer?]) string?]
Returns a string containing the first @racket[_n] words of @racket[_str], removing any trailing
punctuation.
punctuation. It will trip on opening punctuation or punctuation surrounded by spaces.
@examples[#:eval dust-eval
(first-words "Another time, perhaps." 2)
(first-words "‘One problem’ – it don’t always do punctuation right." 3)]
@section{Article parsers and helpers}
@defproc[(default-title [date string?]) string?]
|
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
+
+
-
-
-
+
+
+
-
-
+
|
Given a list of tagged X-expressions (ideally a list of @code{note}s), returns two values: the value
of the @racket['disposition] attribute for the last note that contains one, and the ID of that note.
@examples[#:eval dust-eval
(define notelist
(list
(define notelist (list '(note [[date "2018-02-19"] [disposition "* problematic"]] "First note")
'(note [[date "2018-03-19"]] "Second note")
'(note [[date "2018-04-19"] [disposition "† recanted"]] "Third note")))
'(note [[date "2018-02-19"] [disposition "* problematic"]] "First note")
'(note [[date "2018-03-19"]] "Second note")
'(note [[date "2018-04-19"] [disposition "† recanted"]] "Third note")))
(notes->last-disposition-values notelist)]
;; Extract the last disposition (if any), and the ID of the disposing note, out of a list of notes
(notes->last-disposition-values notelist)]
@section{Date formatters}
@defproc[(ymd->english [ymd-string string?]) string?]
|