@@ -14,12 +14,11 @@ (except-in pollen/core select) ; avoid conflict with deta ) (require "dust.rkt" "cache.rkt" "snippets-html.rkt") -(provide parse-and-cache-article! - cache-series!) +(provide parse-and-cache-article!) (define current-title (make-parameter #f)) (define current-excerpt (make-parameter #f)) (define current-notes (make-parameter '())) (define current-disposition (make-parameter "")) @@ -53,11 +52,11 @@ (current-disposition) (current-disp-id))] [title-html (->html title-tx #:splice? #t)] [title-plain (tx-strs title-tx)] [header (html$-article-open pagenode title-specified? title-tx pubdate)] - [series-node (metas-series-pagenode)] + [series-node (current-series-pagenode)] [footertext (make-article-footertext pagenode series-node (current-disposition) (current-disp-id) (length (current-notes)))] @@ -79,11 +78,11 @@ #:published pubdate #:updated (maybe-meta 'updated) #:author (maybe-meta 'author default-authorname) #:conceal (maybe-meta 'conceal) #:series-page series-node - #:noun-singular (maybe-meta 'noun (series-metas-noun)) + #:noun-singular (maybe-meta 'noun (current-series-noun)) #:note-count (length (current-notes)) #:content-html doc-html #:disposition (current-disposition) #:disp-html-anchor (current-disp-id) #:listing-full-html listing-full @@ -119,14 +118,14 @@ `(title ,@title-elems ,disposition-part)) ;; Convert a bunch of information about an article into some nice English and links. (define (make-article-footertext pagenode series disposition disp-note-id note-count) (define series-part - (match (series-metas-title) + (match (current-series-title) [(? non-empty-string? s-title) (format "This is ~a, part of ‘~a’." - (series-metas-noun) + (current-series-noun) series s-title)] [_ ""])) (define disp-part (cond [(non-empty-string? disposition) @@ -202,11 +201,11 @@ #:title-plain (tx-strs title-tx) #:published note-date #:author author #:author-url author-url #:disposition disposition-attr - #:series-page (metas-series-pagenode) + #:series-page (current-series-pagenode) #:conceal (or (maybe-attr 'conceal attrs #f) (maybe-meta 'conceal)) #:content-html content-html #:listing-full-html listing-full #:listing-excerpt-html listing-full #:listing-short-html "")) @@ -253,22 +252,5 @@ (unless (null? entry-txs) (void (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) - (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 "")))))