@@ -10,11 +10,11 @@ racket/match racket/string txexpr pollen/template (except-in pollen/core select) ; avoid conflict with deta -) + ) (require "dust.rkt" "cache.rkt" "snippets-html.rkt") (provide parse-and-cache-article! cache-series!) @@ -47,11 +47,11 @@ [listing-short (html$-article-listing-short pagenode pubdate title-html)] [notes-section-html (cache-notes! pagenode title-plain note-txprs)]) (cache-index-entries! pagenode doc) ; note original doc is used here (current-plain-title title-plain) (delete-article! pagenode) - (insert-one! cache-conn + (insert-one! (cache-conn) (make-cache:article #:page pagenode #:title-plain title-plain #:title-html-flow title-html #:title-specified? title-specified? @@ -130,12 +130,12 @@ [else ""])) ;; ~~~ Notes ~~~ (define (cache-notes! pagenode parent-title note-txprs) - (query-exec cache-conn (delete (~> (from cache:note #:as n) - (where (= n.page ,(symbol->string pagenode)))))) + (query-exec (cache-conn) (delete (~> (from cache:note #:as n) + (where (= n.page ,(symbol->string pagenode)))))) (cond [(not (null? note-txprs)) (define note-htmls (for/list ([n (in-list note-txprs)]) (cache-note! n pagenode parent-title))) (html$-notes-section note-htmls)] @@ -162,11 +162,11 @@ [title-tx (make-note-title pagenode parent-title-plain)] [title-html (->html title-tx #:splice? #t)] [author (maybe-attr 'author attrs default-authorname)] [author-url (maybe-attr 'author-url attrs)] [content-html (html$-note-contents disp-mark disp-verb elems)]) - (insert-one! cache-conn + (insert-one! (cache-conn) (make-cache:note #:page pagenode #:html-anchor note-id #:title-html-flow title-html #:title-plain (tx-strs title-tx) @@ -222,29 +222,29 @@ ;; Save any index entries in doc to the SQLite cache. ;; Sub-entries are specified by "!" in the index key (define (cache-index-entries! pagenode doc) (define-values (_ entry-txs) (splitf-txexpr doc index-entry-txpr?)) ; Naive idempotence: delete and re-insert all index entries every time doc is rendered. - (query-exec cache-conn (delete (~> (from cache:index-entry #:as entry) - (where (= entry.page ,(symbol->string pagenode)))))) + (query-exec (cache-conn) (delete (~> (from cache:index-entry #:as entry) + (where (= entry.page ,(symbol->string pagenode)))))) (unless (null? entry-txs) (void - (apply insert! cache-conn + (apply insert! (cache-conn) (for/list ([etx (in-list entry-txs)]) (txexpr->index-entry etx pagenode)))))) ;; 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 + (query-exec (cache-conn) (delete (~> (from cache:series #:as s) (where (= s.page ,here-page))))) (void - (insert-one! cache-conn + (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 "")))))