◊(Local Yarn Code "Diff")

Differences From Artifact [8c1589ae]:

To Artifact [727011c9]:


16
17
18
19
20
21
22

23
24
25
26
27
28
29

30
31
32
33
34
35
36
37
38
16
17
18
19
20
21
22
23
24
25
26
27
28
29

30


31
32
33
34
35
36
37







+






-
+
-
-








(provide init-cache-db!
         cache-conn                     ; The most eligible bachelor in Neo Yokyo
         (schema-out cache:article)
         (schema-out cache:note)
         (schema-out cache:series)
         (schema-out cache:index-entry)
         (schema-out listing)
         delete-article!
         delete-notes!
         current-plain-title
         articles
         articles+notes
         listing-htmls
         <listing-full>
         fenced-listing
         <listing-excerpt>
         <listing-short>
         unfence
         preheat-series!
         series-grouped-list)

;; Cache DB and Schemas

(define DBFILE (build-path (current-project-root) "vitreous.sqlite"))
182
183
184
185
186
187
188
189

190
191
192

193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
181
182
183
184
185
186
187

188



189









190
191
192
193
194
195
196







-
+
-
-
-
+
-
-
-
-
-
-
-
-
-







;; Get all the a list of the HTML all the results in a query
(define (listing-htmls list-query)
  (for/list ([l (in-entities (cache-conn) list-query)])
    (listing-html l)))

;; 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 (fenced-listing q)
;; E.g.: (<listing-full> articles+notes)
(define (<listing-full> query-func #:series [s #t] #:limit [lim -1] #:order [ord 'desc])
  `(style ,@(listing-htmls (query-func 'full #:series s #:limit lim #:order ord))))
  `(style ,@(listing-htmls q)))
;;                                     ^^^^^

(define (<listing-excerpt> query-func #:series [s #t] #:limit [lim -1] #:order [ord 'desc])
  `(style ,@(listing-htmls (query-func 'excerpt #:series s #:limit lim #:order ord))))
;;                                     ^^^^^^^^

(define (<listing-short> query-func #:series [s #t] #:limit [lim -1] #:order [ord 'desc])
  `(style ,@(listing-htmls (query-func 'short #:series s #:limit lim #:order ord))))
;;                 ^^^^^^

;; 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 ""))

;;