}
@defproc[(preheat-series!) void?]{
Save info about each series in @racket[series-folder] to the cache.
}@defparam[current-plain-title title-plain non-empty-string? #:value "void"]{Contains (or sets) the “plain” title (i.e., with no HTML markup) for the current article based onanalysis done by @racket[parse-and-cache-article!]. If the article did not specify a title,a default title is supplied. If the article contained a @racket[note] that used the@code{#:disposition} attribute, the disposition-mark may be included in the title.This is a weird parameter, and at some point I will probably get rid of it and have@racket[parse-and-cache-article!] supply it as an extra return value instead.@margin-note{Note that this needs to be called @emph{after} @racket[parse-and-cache-article!] inorder to get an up-to-date value.}}
@section{Retrieving cached data}
Some of this looks a little wacky, but it’s a case of putting a little extra complextity into the
back end to make things simple on the front end. These functions are most commonly used inside the
@emph{body} of a Pollen document (i.e., series pages).
#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
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!)
;; Save an article and its notes (if any) to the database, and return the
;; rendered HTML of the complete article.;; Save an article and its notes (if any) to the database, and return
;; (values plain-title [rendered HTML of the complete article])
(define (parse-and-cache-article! pagenode doc)
(define-values (doc-no-title maybe-title)
(splitf-txexpr doc (make-tag-predicate 'title)))
(define-values (body-txpr note-txprs)
(splitf-txexpr doc-no-title (make-tag-predicate 'note)))
(define-values (disposition disp-note-id)
(notes->last-disposition-values note-txprs))
<!DOCTYPE html>
◊; SPDX-License-Identifier: BlueOak-1.0.0
◊; This file is licensed under the Blue Oak Model License 1.0.0.
<html lang="en">
◊(define article-html (parse-and-cache-article! here doc))
◊html$-page-head[(current-plain-title)]
◊(define-values (plain-title article-html) (parse-and-cache-article! here doc))
◊html$-page-head[plain-title]
◊html$-page-body-open[]
◊article-html
◊html$-page-body-close[]
</html>