@@ -21,51 +21,135 @@ ;; https://joeldueck.com ;; ------------------------------------------------------------------------- ;; Provides functions for displaying content in HTML templates. (require pollen/core - "dates.rkt") - -(provide (all-defined-out)) - -(define (html-head [title #f]) - ◊@{ - The Local Yarn◊when/splice[title]{: ◊title} - - - - }) - -(define (html-page-top) - ◊@{
-
- -

The Local Yarn

-
}) - -(define (html-article-header) - (define title (select-from-metas 'title (current-metas))) + pollen/template + racket/string + txexpr + openssl/sha1 + "dust.rkt") + +(provide html$-page-head + html$-page-body-open + html$-article-open + html$-article-close + html$-page-body-close + html$-note-title + html$-note-contents + html$-note-listing-full + html$-note-in-article + html$-notes-section) + +(define (html$-page-head [title #f]) + (define title-part (if title (format ": ~a" title) "")) + ◊string-append{ + The Local Yarn◊|title| + + + + }) + +(define (html$-page-body-open) + ◊string-append{
+
+ +

The Local Yarn

+
}) + +(define (html$-article-open title-html-flow published) (define published (select-from-metas 'published (current-metas))) - (cond - [title - ◊string-append{
-

◊|title|

-

- -

-
}] - [else - ◊string-append{
-

- -

-
}])) - -(define (html-article-footer) + (cond + [title-html-flow + ◊string-append{
+

◊|title-html-flow|

+

+ +

+
}] + [else + ◊string-append{
+

+ +

+
}])) + +(define (html$-article-close) ◊string-append{
-
(Part of ‘Talking About Poetry’. Once I threw a mudball at a birdhouse. I’m not exactly proud of it, though.)
-
}) +
(Part of ‘Talking About Poetry’. Once I threw a mudball at a birdhouse. I’m not exactly proud of it, though.)
+
}) + + +(define (html$-page-body-close) + ◊string-append{
By Joel Dueck
+
}) + +;; Notes +;; +(define (html$-note-title author pagenode parent-title) + (define author-part + (cond [(and (non-empty-string? author) + (not (string-ci=? author default-authorname))) + (format "A note from ~a, " author)] + [else ""])) + (define article-part + (format "Re: ~a" + pagenode + parent-title)) + (string-append author-part article-part)) + +(define (html$-note-contents disposition-mark elems) + (define-values (first-tag first-attrs first-elems) (txexpr->values (car elems))) + (define disposition + (cond [(non-empty-string? disposition-mark) + `(span [[class "disposition-mark"]] ,disposition-mark)] + [else ""])) + (define body-elems + (cond + [(equal? 'p first-tag) + (cons (txexpr 'p first-attrs (cons disposition first-elems)) (cdr elems))] + [else + (cons disposition elems)])) + (string-append* (map ->html body-elems))) + +(define (html$-note-listing-full pagenode note-id title-html-flow date author author-url contents) + (define author-part + (cond [(non-empty-string? author) + ◊string-append{ +
+ —◊|author| +
}] + [else ◊string-append{ +
+ —◊|default-authorname| +
}])) + + ◊string-append{ +
+

◊|title-html-flow|

+

+ +

+
+
◊|contents|
+ ◊author-part +
+
}) +(define (html$-note-in-article id date author author-url contents) + ◊string-append{ +
+

+

+
+ ◊contents +
+
+ —◊|author| +
+
}) -(define (html-page-bottom) - ◊@{ -
}) +(define (html$-notes-section note-htmls) + ◊string-append{
+

Further Notes

+ ◊(apply string-append note-htmls) +
})