◊(Local Yarn Code "Diff")

Differences From Artifact [0653072f]:

To Artifact [785c90f0]:


63
64
65
66
67
68
69




70
71
72
73





74
75
76
77
78
79
80
63
64
65
66
67
68
69
70
71
72
73
74
75
76

77
78
79
80
81
82
83
84
85
86
87
88







+
+
+
+



-
+
+
+
+
+







Look up a value in @code{(current-metas)} that may or may not be present, returning the value of
@racket[_missing-expr] if it’s not there.

@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?]

Titles are not required for articles, but there are contexts where you need something that
serves as a title if one is not present, and that’s what this function supplies.
118
119
120
121
122
123
124


125
126
127



128
129
130

131
132
133
134
135
136
137
126
127
128
129
130
131
132
133
134



135
136
137

138

139
140
141
142
143
144
145
146







+
+
-
-
-
+
+
+
-

-
+








@defproc[(notes->last-disposition-values [txprs (listof txexpr?)]) any]

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?]

Converts a date-string of the form @code{"YYYY-MM-DD"} to a string of the form @code{"Monthname D,
YYYY"}.