@@ -3,11 +3,10 @@ ; 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 @@ -17,12 +16,12 @@ (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))) @@ -45,11 +44,10 @@ (length note-txprs))] [footer (html$-article-close footertext)] [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) (make-cache:article #:page pagenode #:title-plain title-plain @@ -66,11 +64,11 @@ #:disposition disposition #:disp-html-anchor disp-note-id #:listing-full-html (string-append header doc-html footer) #:listing-excerpt-html "" #:listing-short-html listing-short)) - (string-append header doc-html notes-section-html footer))) + (values title-plain (string-append header doc-html notes-section-html footer)))) (define (check-for-poem-title doc-txpr) (match (car (get-elements doc-txpr)) [(txexpr 'div (list (list 'class "poem"))