8 Crystalize
(require "crystalize.rkt") |
“Crystalizing” is an extra layer in between docs and templates that destructures the doc and stores it in various pieces in a SQLite cache. Individual articles save chunks of rendered HTML to the cache when their individual pages are rendered. When pulling together listings of articles in different contexts that need to be filtered and sorted, a SQL query is much faster than trolling through the Pollen cache for matching docs and regenerating the HTML.
These functions are designed to be used within the template for articles and series, respectively, so that the cache is updated precisely when the web page is rendered.
procedure
(parse-and-cache-article! pagenode doc)
→
non-empty-string? non-empty-string? pagenode : pagenode? doc : txexpr?
The title is returned separately for use in the HTML <title> tag. If the doc doesn’t specify a title, a provisional title is constructed using default-title.
Privately, it does a lot of other work. The article is analyzed, additional metadata is constructed and saved to the SQLite cache and saved using make-cache:article. If the article specifies a 'series meta, information about that series is fetched and used in the rendering of the article. If there are notes or index tags in the doc, they are parsed and saved individually to the SQLite cache (using make-cache:note and make-cache:index-entry). If any of the notes use the #:disposition attribute, information about the disposition is parsed out and used in the rendering of the article.