1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#lang racket/base
; SPDX-License-Identifier: BlueOak-1.0.0
; This file is licensed under the Blue Oak Model License 1.0.0.
(require deta
db/base
db/sqlite3
threading
pollen/setup
racket/match
"dust.rkt"
(except-in pollen/core select))
(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)
delete-article!
delete-notes!
current-plain-title
articles
articles+notes
listing-htmls
<listing-full>
<listing-excerpt>
<listing-short>
unfence)
;; Cache DB and Schemas
(define DBFILE (build-path (current-project-root) "vitreous.sqlite"))
(define cache-conn (sqlite3-connect #:database DBFILE #:mode 'create))
(define current-plain-title (make-parameter "void"))
|
>
>
|
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#lang racket/base
; SPDX-License-Identifier: BlueOak-1.0.0
; This file is licensed under the Blue Oak Model License 1.0.0.
(require deta
db/base
db/sqlite3
threading
pollen/setup
racket/match
(rename-in racket/list
(group-by group-list-by))
"dust.rkt"
(except-in pollen/core select))
(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)
delete-article!
delete-notes!
current-plain-title
articles
articles+notes
listing-htmls
<listing-full>
<listing-excerpt>
<listing-short>
unfence
series-grouped-list)
;; Cache DB and Schemas
(define DBFILE (build-path (current-project-root) "vitreous.sqlite"))
(define cache-conn (sqlite3-connect #:database DBFILE #:mode 'create))
(define current-plain-title (make-parameter "void"))
|
197
198
199
200
201
202
203
|
,@(listing-htmls (query-func 'short #:series s #:limit lim #:order ord))
"</ul>")) ;; ^^^^^^
;; 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 ""))
|
>
>
>
>
>
>
>
|
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
,@(listing-htmls (query-func 'short #:series s #:limit lim #:order ord))
"</ul>")) ;; ^^^^^^
;; 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 ""))
;;
;; ~~~ Fetching series ~~~
;;
(define (series-grouped-list)
(~> (for/list ([row (in-entities cache-conn (from cache:series #:as s))]) row)
(group-list-by cache:series-noun-plural _ string-ci=?)))
|