1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
#lang pollen/mode racket/base
; SPDX-License-Identifier: BlueOak-1.0.0
; This file is licensed under the Blue Oak Model License 1.0.0.
;; Provides functions for displaying content in HTML templates.
(require pollen/template
pollen/core
pollen/decode
pollen/private/version
racket/string
racket/function
racket/list
txexpr
"cache.rkt"
|
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#lang pollen/mode racket/base
; SPDX-License-Identifier: BlueOak-1.0.0
; This file is licensed under the Blue Oak Model License 1.0.0.
;; Provides functions for displaying content in HTML templates.
(require pollen/template
pollen/decode
pollen/private/version
racket/string
racket/function
racket/list
txexpr
"cache.rkt"
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
(define body-class (if (non-empty-string? class) (format " class=\"~a\"" class) ""))
◊string-append{<body◊|body-class|><main>
<a href="/index.html"><header>
<img src="/web-extra/mark.svg" alt="The Local Yarn" height="103" class="logo">
<h1>The Local Yarn</h1>
</header></a>})
(define (html$-repo-links)
(define here (path->string (here-source-path)))
(cond
[(checked-in?)
◊string-append{<div class="scm-links">
<a title="source" href="/code/file/◊here">§</a>
<a title="changes" href="/code/finfo?name=◊here">¢</a>
</div>}]
[else (format "<!-- ~a -->" here) ]))
(define (html$-article-open pagenode title? title-tx published)
(cond
[title?
|
|
>
|
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
(define body-class (if (non-empty-string? class) (format " class=\"~a\"" class) ""))
◊string-append{<body◊|body-class|><main>
<a href="/index.html"><header>
<img src="/web-extra/mark.svg" alt="The Local Yarn" height="103" class="logo">
<h1>The Local Yarn</h1>
</header></a>})
(define (html$-repo-links [line #f])
(define here (path->string (here-source-path)))
(define line-param (if line (format "?ln=~a" line) ""))
(cond
[(checked-in?)
◊string-append{<div class="scm-links">
<a title="source" href="/code/file/◊|here|◊line-param">§</a>
<a title="changes" href="/code/finfo?name=◊here">¢</a>
</div>}]
[else (format "<!-- ~a -->" here) ]))
(define (html$-article-open pagenode title? title-tx published)
(cond
[title?
|
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
[(and (block-txexpr? (car elems)) (non-empty-string? disposition-mark))
(define-values (first-tag first-attrs first-elems) (txexpr->values (car elems)))
(cons (txexpr first-tag 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 contents [author default-authorname] [author-url ""])
(define author-part
(cond [(non-empty-string? author-url)
◊string-append{
<div class="note-meta">
—<a class="u-author h-card" href="◊|author-url|"><i>◊|author|</i></a>
</div>}]
[else ◊string-append{
<div class="note-meta">
—<span class="h-card"><i>◊|author|</i></span>
</div>}]))
(define maybe-author-class
(cond [(string=? author default-authorname) "by-proprietor"]
[else ""]))
◊string-append{
<article class="with-title ◊maybe-author-class hentry">
<h1 class="entry-title note-full">◊|title-html-flow|</h1>
<p class="time"><a href="/◊(symbol->string pagenode)#◊note-id" class="rel-bookmark note-permlink">
<time datetime="◊date">◊ymd->english[date]</time>
</a></p>
<section class="entry-content">
<div class="p-content p-name">◊|contents|</div>
◊author-part
</section>
</article>})
(define (html$-note-in-article id date contents author author-url)
|
|
>
>
|
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
[(and (block-txexpr? (car elems)) (non-empty-string? disposition-mark))
(define-values (first-tag first-attrs first-elems) (txexpr->values (car elems)))
(cons (txexpr first-tag 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 srcline contents [author default-authorname] [author-url ""])
(define author-part
(cond [(non-empty-string? author-url)
◊string-append{
<div class="note-meta">
—<a class="u-author h-card" href="◊|author-url|"><i>◊|author|</i></a>
</div>}]
[else ◊string-append{
<div class="note-meta">
—<span class="h-card"><i>◊|author|</i></span>
</div>}]))
(define maybe-author-class
(cond [(string=? author default-authorname) "by-proprietor"]
[else ""]))
◊string-append{
<article class="with-title ◊maybe-author-class hentry">
<h1 class="entry-title note-full">◊|title-html-flow|</h1>
<p class="time"><a href="/◊(symbol->string pagenode)#◊note-id" class="rel-bookmark note-permlink">
<time datetime="◊date">◊ymd->english[date]</time>
</a></p>
◊(html$-repo-links srcline)
<section class="entry-content">
<div class="p-content p-name">◊|contents|</div>
◊author-part
</section>
</article>})
(define (html$-note-in-article id date contents author author-url)
|