◊(Local Yarn Code "Diff")

Differences From Artifact [013cbdf1]:

To Artifact [0c40f48a]:


45
46
47
48
49
50
51
52
53
54



55
56
57
58
59
60
61
45
46
47
48
49
50
51



52
53
54
55
56
57
58
59
60
61







-
-
-
+
+
+







;; ~~~ Provides ~~~

(provide spell-of-summoning!
         crystalize-article!
         article-plain-title
         list/articles
         list/articles+notes
         list-short/articles
         list-full/articles
         list-full/articles+notes
         listing<>-short/articles
         listing<>-full/articles
         listing<>-full/articles+notes
         unfence
         preheat-series!)

;; ~~~ Private use ~~~

(define DBFILE (build-path (current-project-root) "vitreous.sqlite"))

195
196
197
198
199
200
201
202

203
204
205
206
207

208
209
210
211

212
213
214
215
216
217
218
195
196
197
198
199
200
201

202
203
204
205
206

207
208
209
210

211
212
213
214
215
216
217
218







-
+




-
+



-
+







  (define select "SELECT `~a` FROM `articles` ~a ORDER BY `published` ~a LIMIT ~a")
  (query-list (sqltools:dbc) (format select type (where/series s) order limit)))

;; ~~~~
;; Return cached HTML of articles and/or notes, fenced within a style txexpr to prevent it being
;; escaped by ->html. See also: definition of `unfence`

(define (list-short/articles #:series [s #t] #:limit [limit -1] [order "DESC"])
(define (listing<>-short/articles #:series [s #t] #:limit [limit -1] [order "DESC"])
  `(style "<ul class=\"article-list\">"
          ,@(list/articles "listing_short_html" #:series s #:limit limit order)
          "</ul>"))

(define (list-full/articles #:series [s #t] #:limit [limit -1] [order "DESC"])
(define (listing<>-full/articles #:series [s #t] #:limit [limit -1] [order "DESC"])
  `(style ,@(list/articles "listing_full_html" #:series s #:limit limit order)))

;; Return a combined list of articles and notes (“full content” version) sorted by date
(define (list-full/articles+notes #:series [s #t] #:limit [limit -1] [order "DESC"])
(define (listing<>-full/articles+notes #:series [s #t] #:limit [limit -1] [order "DESC"])
  `(style ,@(list/articles+notes "listing_full_html" #:series s #:limit limit order)))

;; Remove "<style>" and "</style>" introduced by using ->html on docs containing output from
;; listing functions
(define (unfence html-str)
  (regexp-replace* #px"<[\\/]{0,1}style>" html-str ""))