Overview
Comment: | Add and document ‘magick’ tag function |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
adf0d96ed6045f10e9286f54b441e3ef |
User & Date: | joel on 2020-03-20 03:43:34 |
Other Links: | manifest | tags |
Context
2020-03-22
| ||
17:35 | Add sep tag function check-in: 58c1f025 user: joel tags: trunk | |
2020-03-20
| ||
03:43 | Add and document ‘magick’ tag function check-in: adf0d96e user: joel tags: trunk | |
03:25 | Minor edits to code docs check-in: 1da389c4 user: joel tags: trunk | |
Changes
Modified code-docs/pollen.scrbl from [7542dfd6] to [d72bbc57].
︙ | ︙ | |||
247 248 249 250 251 252 253 254 255 256 257 258 259 260 | 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. } | > > > > > > > | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | 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[(magick [element xexpr?] ...) txexpr?]{ Typeset contents using historical ligatures and the “long s” conventions of 17th-century English books. } @defproc[(blockquote [element xexpr?] ...) txexpr?]{ Surrounds a block quotation. To cite a source, use @racket[attrib] immediately afterward. } |
︙ | ︙ |
Modified pollen.rkt from [0c603aac] to [956611c9].
︙ | ︙ | |||
98 99 100 101 102 103 104 105 106 107 108 109 110 111 | (poly-branch-tag center) (poly-branch-tag section) (poly-branch-tag subsection) (poly-branch-tag code) (poly-branch-tag dialogue) (poly-branch-tag say) (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) | > | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | (poly-branch-tag center) (poly-branch-tag section) (poly-branch-tag subsection) (poly-branch-tag code) (poly-branch-tag dialogue) (poly-branch-tag say) (poly-branch-tag saylines) (poly-branch-tag magick) ; Extra-fancy ligatures, “long s” (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) |
︙ | ︙ |
Modified tags-html.rkt from [d6b064c2] to [977f81cb].
︙ | ︙ | |||
69 70 71 72 73 74 75 76 77 78 79 80 81 82 | 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 | > | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | html-index html-figure html-figure-@2x html-image-link html-dialogue html-say html-saylines html-magick html-verse html-attrib html-link html-xref html-url html-fn html-fndef |
︙ | ︙ | |||
139 140 141 142 143 144 145 146 147 148 149 150 151 152 | [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))) | > > > > > > > > > > > > > > > > > > > > > > > | 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 168 169 170 171 172 173 174 175 176 | [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-magick . elems) (txexpr 'div '([class "antique"]) (decode-elements elems #:string-proc (λ (s) (regexp-replace* #px"(?<!f)s(?![fkb\\s]|$)" s "ſ"))))) (module+ test (require rackunit) ; round s at the end of a word (check-equal? (html-magick "is") '(div [[class "antique"]] "is")) ; round s before/after f (check-equal? (html-magick "offset, satisfaction") '(div [[class "antique"]] "offset, ſatisfaction")) ; long s before hyphen (check-equal? (html-magick "Shafts-bury") '(div [[class "antique"]] "Shaftſ-bury")) ; round s before k or b (17th-century rules) (check-equal? (html-magick "ask, husband") '(div [[class "antique"]] "ask, husband")) ; long s everywhere else (check-equal? (html-magick "song, substitutes") '(div [[class "antique"]] "ſong, ſubſtitutes")) ;; Nested elements (check-equal? (html-magick '(root "This is " (a [[href "class"]] (b "song, substitutes")))) '(div [[class "antique"]] (root "This is " (a [[href "class"]] (b "ſong, ſubſtitutes")))))) (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))) |
︙ | ︙ |