59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
+
+
+
+
|
html-item
html-section
html-subsection
html-newthought
html-caps
html-mono
html-center
html-strike
html-block
html-blockcode
html-index
html-figure
html-figure-@2x
html-image-link
html-dialogue
html-say
html-saylines
html-verse
html-attrib
html-link
html-xref
html-url
html-fn
html-fndef
html-note)
(define html-item (default-tag-function 'li))
(define html-section (default-tag-function 'h2))
(define html-subsection (default-tag-function 'h3))
(define html-newthought (default-tag-function 'span #:class "newthought"))
(define html-caps (default-tag-function 'span #:class "caps"))
(define html-center (default-tag-function 'div #:style "text-align: center"))
(define html-strike (default-tag-function 'span #:style "text-decoration: line-through"))
(define html-dialogue (default-tag-function 'dl #:class "dialogue"))
(define html-mono (default-tag-function 'samp))
(define (html-block . elements)
`(section [[class "content-block"]] (div [[class "content-block-main"]] ,@elements)))
(define (html-root . elements)
|
136
137
138
139
140
141
142
143
144
145
|
140
141
142
143
144
145
146
147
148
149
150
151
|
+
+
|
[pre-attrs (cond [italic? '([class "verse"] [style "font-style: italic"])]
[else '([class "verse"])])]
[pre-title (cond [(string>? title "") `(p [[class "verse-heading"]] ,title)]
[else ""])])
`(div [[class "poem"]] ,pre-title (pre ,pre-attrs ,@elems))))
(define html-attrib (default-tag-function 'div #:class "attrib"))
;; (Private) Get the dimensions of an image file
(define (get-image-size filepath)
(define bmp (make-object bitmap% filepath))
(list (send bmp get-width) (send bmp get-height)))
|
208
209
210
211
212
213
214
215
216
217
|
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
+
+
+
+
+
+
|
(let* ([url-ref (attr-ref tx 'ref)]
[url (or (hash-ref link-urls url-ref #f)
(format "Missing reference: ~a" url-ref))])
`(a [[href ,url]] ,@(get-elements tx)))]
[else tx]))
;; Quick link to another article
(define (html-xref . elems)
`(a [[href ,(format "~aarticles/~a.html" web-root (first elems))]
[class "xref"]]
,@(rest elems)))
;; Footnotes
;;
;; Private use:
(define fn-names null)
|