◊(Local Yarn Code "Check-in [58810a67]")

Overview
Comment:Add attrib, mono, and xref tags. Tweak styles for titles, code.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 58810a67fa21ebb82f78410ec86f0f0b0a512f0bd0b8f1a2de31bc4d71c6e79c
User & Date: joel on 2020-03-10 18:18:03
Other Links: manifest | tags
Context
2020-03-14
00:19
Time to stop ignoring articles check-in: bfb927f4 user: joel tags: trunk
2020-03-10
18:18
Add attrib, mono, and xref tags. Tweak styles for titles, code. check-in: 58810a67 user: joel tags: trunk
2020-03-08
15:35
Fiddle with columnar lists again check-in: f0afc42f user: joel tags: trunk
Changes

Modified code-docs/pollen.scrbl from [0570e08d] to [7542dfd6].

245
246
247
248
249
250
251


252
253
254
255
256






257
258
259
260
261
262
263
264
265
266
267
268

269
270
271
272
273
274
275
Typeset contents as poetry, with line breaks preserved and the block centered on the longest line.
To set the whole block in italic, use @code{#:italic? #t} — otherwise, use @code{i} within the
block.

If the first element in an article is a @racket[verse] tag with the @racket[#:title] attribute
specified, that title is used as the article’s title if the normal @racket[title] tag is absent.



}

@defproc[(blockquote [element xexpr?] ...) txexpr?]{

Surrounds a block quotation. To cite a source, include a @code{footer} tag at the bottom.







}

@defproc[(blockcode [element xexpr?] ...) txexpr?]{

Typeset contents as a block of code using a monospace font. Line breaks are preserved.

}

@deftogether[(@defproc[(i      [element xexpr?] ...) txexpr?]
              @defproc[(em     [element xexpr?] ...) txexpr?]
              @defproc[(b      [element xexpr?] ...) txexpr?]

              @defproc[(strong [element xexpr?] ...) txexpr?]
              @defproc[(strike [element xexpr?] ...) txexpr?]
              @defproc[(ol     [element xexpr?] ...) txexpr?]
              @defproc[(ul     [element xexpr?] ...) txexpr?]
              @defproc[(item   [element xexpr?] ...) txexpr?]
              @defproc[(sup    [element xexpr?] ...) txexpr?]
              @defproc[(caps   [element xexpr?] ...) txexpr?]







>
>




|
>
>
>
>
>
>












>







245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
Typeset contents as poetry, with line breaks preserved and the block centered on the longest line.
To set the whole block in italic, use @code{#:italic? #t} — otherwise, use @code{i} within the
block.

If the first element in an article is a @racket[verse] tag with the @racket[#:title] attribute
specified, that title is used as the article’s title if the normal @racket[title] tag is absent.

To cite a source, use @racket[attrib] immediately afterward.

}

@defproc[(blockquote [element xexpr?] ...) txexpr?]{

Surrounds a block quotation. To cite a source, use @racket[attrib] immediately afterward.

}

@defproc[(attrib [element xexpr?] ...) txexpr?]{

An attribution line, for citing a source for a block quotation, epigraph or poem.

}

@defproc[(blockcode [element xexpr?] ...) txexpr?]{

Typeset contents as a block of code using a monospace font. Line breaks are preserved.

}

@deftogether[(@defproc[(i      [element xexpr?] ...) txexpr?]
              @defproc[(em     [element xexpr?] ...) txexpr?]
              @defproc[(b      [element xexpr?] ...) txexpr?]
              @defproc[(mono   [element xexpr?] ...) txexpr?]
              @defproc[(strong [element xexpr?] ...) txexpr?]
              @defproc[(strike [element xexpr?] ...) txexpr?]
              @defproc[(ol     [element xexpr?] ...) txexpr?]
              @defproc[(ul     [element xexpr?] ...) txexpr?]
              @defproc[(item   [element xexpr?] ...) txexpr?]
              @defproc[(sup    [element xexpr?] ...) txexpr?]
              @defproc[(caps   [element xexpr?] ...) txexpr?]

Modified pollen.rkt from [da1550cf] to [d1969801].

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(require (for-syntax racket/base
                     racket/syntax
                     syntax/parse
                     pollen/setup))

(require pollen/tag
         pollen/setup
         racket/function
         "cache.rkt"
         "tags-html.rkt"
         "snippets-html.rkt"
         "crystalize.rkt")

(provide (all-defined-out)
         (all-from-out "crystalize.rkt" "snippets-html.rkt" "cache.rkt"))







<







8
9
10
11
12
13
14

15
16
17
18
19
20
21
(require (for-syntax racket/base
                     racket/syntax
                     syntax/parse
                     pollen/setup))

(require pollen/tag
         pollen/setup

         "cache.rkt"
         "tags-html.rkt"
         "snippets-html.rkt"
         "crystalize.rkt")

(provide (all-defined-out)
         (all-from-out "crystalize.rkt" "snippets-html.rkt" "cache.rkt"))
79
80
81
82
83
84
85

86
87
88
89
90
91
92
(poly-branch-tag excerpt)
(poly-branch-tag excerpt*)
    
(poly-branch-tag p)
(poly-branch-tag i)
(poly-branch-tag em)
(poly-branch-tag b)

(poly-branch-tag strong)
(poly-branch-tag strike)
;(poly-branch-tag color)
(poly-branch-tag ol)
(poly-branch-tag ul)
(poly-branch-tag item)
(poly-branch-tag sup)







>







78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
(poly-branch-tag excerpt)
(poly-branch-tag excerpt*)
    
(poly-branch-tag p)
(poly-branch-tag i)
(poly-branch-tag em)
(poly-branch-tag b)
(poly-branch-tag mono)
(poly-branch-tag strong)
(poly-branch-tag strike)
;(poly-branch-tag color)
(poly-branch-tag ol)
(poly-branch-tag ul)
(poly-branch-tag item)
(poly-branch-tag sup)
102
103
104
105
106
107
108

109
110
111

112
113
114
115
116
117
118
(poly-branch-tag saylines)
(poly-branch-kwargs-tag index)
(poly-branch-tag figure)
(poly-branch-tag figure-@2x)
(poly-branch-tag image-link)
(poly-branch-kwargs-tag blockcode)
(poly-branch-kwargs-tag verse)          ; [#:title ""] [#:italic "no"]


(poly-branch-tag link)
(poly-branch-tag url)

(poly-branch-tag fn)
(poly-branch-tag fndef)

(poly-branch-kwargs-tag note)
(poly-branch-tag block)

;; Not yet implemented







>



>







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
(poly-branch-tag saylines)
(poly-branch-kwargs-tag index)
(poly-branch-tag figure)
(poly-branch-tag figure-@2x)
(poly-branch-tag image-link)
(poly-branch-kwargs-tag blockcode)
(poly-branch-kwargs-tag verse)          ; [#:title ""] [#:italic "no"]
(poly-branch-tag attrib)

(poly-branch-tag link)
(poly-branch-tag url)
(poly-branch-tag xref)
(poly-branch-tag fn)
(poly-branch-tag fndef)

(poly-branch-kwargs-tag note)
(poly-branch-tag block)

;; Not yet implemented

Modified tags-html.rkt from [d7a74b7d] to [6b6aeed1].

57
58
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
         html-excerpt
         html-excerpt*
         html-item
         html-section
         html-subsection
         html-newthought
         html-caps

         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-link

         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-block . elements)
  `(section [[class "content-block"]] (div [[class "content-block-main"]] ,@elements)))

(define (html-root . elements)
  (invalidate-series)
  (define first-pass







>












>

>













>







57
58
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
99
100
         html-excerpt
         html-excerpt*
         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)
  (invalidate-series)
  (define first-pass
134
135
136
137
138
139
140


141
142
143
144
145
146
147
  (let* ([title  (maybe-attr 'title attrs "")]
         [italic? (assoc 'italic? attrs)]
         [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))))



;; (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)))

;; (Private) Builds a path to an image in the [image-dir] subfolder of the current document's 







>
>







138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
  (let* ([title  (maybe-attr 'title attrs "")]
         [italic? (assoc 'italic? attrs)]
         [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)))

;; (Private) Builds a path to an image in the [image-dir] subfolder of the current document's 
206
207
208
209
210
211
212






213
214
215
216
217
218
219
(define (decode-link-urls tx)
  (cond [(eq? (get-tag tx) 'link&)
         (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]))







;; Footnotes
;;
;; Private use:
(define fn-names null)
(define fn-definitions (make-hash))
(define (fn-id x) (here-id (string-append x "_fn")))







>
>
>
>
>
>







212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
(define (decode-link-urls tx)
  (cond [(eq? (get-tag tx) 'link&)
         (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)
(define fn-definitions (make-hash))
(define (fn-id x) (here-id (string-append x "_fn")))

Modified web-extra/martin.css.pp from [8e15245c] to [846cd06d].

262
263
264
265
266
267
268




269
270
271
272
273
274
275
276
277
278
279
280

281
282
283
284
285
286
287
   For now: By default, the title-less article is assumed to be the norm. On these, we use <H1> to 
   show the date in italics. */
article>h1 {
    font-size: ◊x-lineheight[1];
    line-height: ◊x-lineheight[1];
    margin: 0 0 ◊x-lineheight[1] 0;
    font-style: italic;




    font-weight: normal;
}

/* Titles non-bold, non-smallcaps by default. This can be overridden in document markup. */
h1.entry-title {
    margin: 0 0 0 0;
    text-transform: none;
    font-style: normal;
    line-height: 1.7rem;
}

h1.entry-title.note-full {

    font-feature-settings: "smcp" on, "liga" on, "clig" on, "dlig" on, "kern" on, "onum" on, "pnum" on;
}

/* This <SPAN> class is used in titles for Notes appended to earlier articles */
h1.entry-title .cross-reference {
    font-feature-settings: "smcp" off, "liga" on, "clig" on, "dlig" on, "kern" on, "onum" on, "pnum" on;
    font-style: italic;







>
>
>
>
|











>







262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
   For now: By default, the title-less article is assumed to be the norm. On these, we use <H1> to 
   show the date in italics. */
article>h1 {
    font-size: ◊x-lineheight[1];
    line-height: ◊x-lineheight[1];
    margin: 0 0 ◊x-lineheight[1] 0;
    font-style: italic;
    font-weight: bold;
}

article.no-title>h1 {
    font-weight: normal
}

/* Titles non-bold, non-smallcaps by default. This can be overridden in document markup. */
h1.entry-title {
    margin: 0 0 0 0;
    text-transform: none;
    font-style: normal;
    line-height: 1.7rem;
}

h1.entry-title.note-full {
    font-weight: normal;
    font-feature-settings: "smcp" on, "liga" on, "clig" on, "dlig" on, "kern" on, "onum" on, "pnum" on;
}

/* This <SPAN> class is used in titles for Notes appended to earlier articles */
h1.entry-title .cross-reference {
    font-feature-settings: "smcp" off, "liga" on, "clig" on, "dlig" on, "kern" on, "onum" on, "pnum" on;
    font-style: italic;
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
    margin: ◊x-lineheight[1.0] 2em;
}

section.entry-content blockquote:first-child {
    margin-top: 0;
}

section.entry-content blockquote footer::before {
    content: '—'; /* Em-dash */
}

section.entry-content blockquote footer {
    margin-top: ◊x-lineheight[1];
    text-align: right;
    width: calc(100% + 2em);
}

section.entry-content h2 {
    font-size: 1.2rem;
    font-style: italic;







<
<
<
<

|







411
412
413
414
415
416
417




418
419
420
421
422
423
424
425
426
    margin: ◊x-lineheight[1.0] 2em;
}

section.entry-content blockquote:first-child {
    margin-top: 0;
}





section.entry-content blockquote footer {
    margin-top: ◊x-lineheight[0.5];
    text-align: right;
    width: calc(100% + 2em);
}

section.entry-content h2 {
    font-size: 1.2rem;
    font-style: italic;
453
454
455
456
457
458
459


460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478






479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497






498
499
500
501
502
503
504
    padding: 0;
    text-indent: 0; 
}

code {
    font-size: 0.75rem;
    font-family: ◊mono-font;


}

pre {
    line-height: ◊derive-lineheight[7 #:per-lines 6];
    max-width: 100%;
    overflow-x: auto;
    tab-size: 4;
}

pre code {
    border: 0;
    background: none;
    font-style: italic;
    font-size: 0.75rem;
}

pre.code {
    border: dotted #aaa 2px;
    padding-left: 0.2em;






}

pre.verse {
    font-family: ◊body-font;
    font-size: 1rem;
    line-height: ◊x-lineheight[1];
    width: auto;
    margin: ◊x-lineheight[1] auto;
    display: table;
    white-space: pre-wrap;
    /* Whitespace is preserved by the browser.
       Text will wrap when necessary, and on line breaks */
}

p.verse-heading {
    font-feature-settings: "smcp" on, "liga" on, "clig" on, "dlig" on, "kern" on, "onum" on, "pnum" on;
    text-align: center;
    font-size: 1.3rem;
}






    
section.entry-content figure {
    margin: ◊x-lineheight[1] 0;
    padding: 0;
}

figure>a {







>
>












<
|





>
>
>
>
>
>



















>
>
>
>
>
>







454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474

475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
    padding: 0;
    text-indent: 0; 
}

code {
    font-size: 0.75rem;
    font-family: ◊mono-font;
    background: #ddd;
    border-radius: 0.2em;
}

pre {
    line-height: ◊derive-lineheight[7 #:per-lines 6];
    max-width: 100%;
    overflow-x: auto;
    tab-size: 4;
}

pre code {
    border: 0;
    background: none;

    font-size: 0.6rem;
}

pre.code {
    border: dotted #aaa 2px;
    padding-left: 0.2em;
    line-height: 0.7rem;
}

samp {
    font-family: ◊mono-font;
    font-size: 0.7rem;
}

pre.verse {
    font-family: ◊body-font;
    font-size: 1rem;
    line-height: ◊x-lineheight[1];
    width: auto;
    margin: ◊x-lineheight[1] auto;
    display: table;
    white-space: pre-wrap;
    /* Whitespace is preserved by the browser.
       Text will wrap when necessary, and on line breaks */
}

p.verse-heading {
    font-feature-settings: "smcp" on, "liga" on, "clig" on, "dlig" on, "kern" on, "onum" on, "pnum" on;
    text-align: center;
    font-size: 1.3rem;
}

div.attrib {
    text-align: right;
    font-size: .8rem;
    margin-top: -◊x-lineheight[0.5];
}
    
section.entry-content figure {
    margin: ◊x-lineheight[1] 0;
    padding: 0;
}

figure>a {