13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
pollen/setup)
(require "dust.rkt" "snippets-html.rkt")
(provide init-cache-db!
cache-conn ; The most eligible bachelor in Neo Yokyo
parse-and-cache-article!
current-plain-title
(schema-out cache:article)
(schema-out cache:note)
(schema-out cache:series)
(schema-out cache:index-entry)
articles
articles+notes
|
>
|
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
pollen/setup)
(require "dust.rkt" "snippets-html.rkt")
(provide init-cache-db!
cache-conn ; The most eligible bachelor in Neo Yokyo
parse-and-cache-article!
cache-series!
current-plain-title
(schema-out cache:article)
(schema-out cache:note)
(schema-out cache:series)
(schema-out cache:index-entry)
articles
articles+notes
|
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
[listing-excerpt-html string/f] ; Not used for now
[listing-short-html string/f])) ; Date and title only
(define-schema cache:series #:table "series"
([id id/f #:primary-key #:auto-increment]
[page symbol/f]
[title string/f]
[published date/f]
[noun-plural string/f]
[noun-singular string/f]))
(define-schema cache:index-entry #:table "index_entries"
([id id/f #:primary-key #:auto-increment]
[entry string/f]
[subentry string/f]
|
|
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
[listing-excerpt-html string/f] ; Not used for now
[listing-short-html string/f])) ; Date and title only
(define-schema cache:series #:table "series"
([id id/f #:primary-key #:auto-increment]
[page symbol/f]
[title string/f]
[published string/f]
[noun-plural string/f]
[noun-singular string/f]))
(define-schema cache:index-entry #:table "index_entries"
([id id/f #:primary-key #:auto-increment]
[entry string/f]
[subentry string/f]
|
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
|
;; listing functions
(define (unfence html-str)
(regexp-replace* #px"<[\\/]{0,1}style>" html-str ""))
;; Save the current article to the `series` table of the SQLite cache
;; Should be called from a template for series pages
(define (cache-series!)
(query-exec cache-conn
(delete (~> (from cache:series #:as s)
(where (= s.page ,(here-output-path))))))
(insert-one! cache-conn
(make-cache:series
#:page (here-output-path)
#:title (hash-ref (current-metas) 'title)
#:published (hash-ref (current-metas) 'published "")
#:noun-plural (hash-ref (current-metas) 'noun-plural "")
#:noun-singular (hash-ref (current-metas) 'noun-singular ""))))
|
>
|
>
|
|
|
|
|
|
|
|
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
|
;; listing functions
(define (unfence html-str)
(regexp-replace* #px"<[\\/]{0,1}style>" html-str ""))
;; Save the current article to the `series` table of the SQLite cache
;; Should be called from a template for series pages
(define (cache-series!)
(define here-page (path->string (here-output-path)))
(query-exec cache-conn
(delete (~> (from cache:series #:as s)
(where (= s.page ,here-page)))))
(void
(insert-one! cache-conn
(make-cache:series
#:page (string->symbol here-page)
#:title (hash-ref (current-metas) 'title)
#:published (hash-ref (current-metas) 'published "")
#:noun-plural (hash-ref (current-metas) 'noun-plural "")
#:noun-singular (hash-ref (current-metas) 'noun-singular "")))))
|