Index: crystalize.rkt ================================================================== --- crystalize.rkt +++ crystalize.rkt @@ -15,10 +15,11 @@ (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) @@ -75,11 +76,11 @@ (define-schema cache:series #:table "series" ([id id/f #:primary-key #:auto-increment] [page symbol/f] [title string/f] - [published date/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] @@ -391,15 +392,17 @@ (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-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 "")))) + (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 "")))))