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

Overview
Comment:Improve accuracy of long-s typesetting rules
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ac35ba69a1779fd6741e9565f85824bb8cc5e5d1daf390e67682c667eadb994e
User & Date: joel on 2020-03-22 17:48:41
Other Links: manifest | tags
Context
2020-03-24
02:37
Use semicolons to separate indexed keywords specified in metas; allows use of commas in the index entry check-in: 474b5560 user: joel tags: trunk
2020-03-22
17:48
Improve accuracy of long-s typesetting rules check-in: ac35ba69 user: joel tags: trunk
17:37
Change typography for sectional headings; add separator styling; save discretionary ligatures for certain elements, not normal body text check-in: 13f9b227 user: joel tags: trunk
Changes

Modified tags-html.rkt from [178b993f] to [c0de1d26].

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
         [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"))))))








>
>
>
|



|
|
|

|

|

|







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
         [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)
  ; always round s at the end of a word
  (check-equal? (html-magick "mirrors? yes, it is") '(div [[class "antique"]] "mirrors? yes, it is"))
  ; always round s before/after f
  (check-equal? (html-magick "offset, satisfaction") '(div [[class "antique"]] "offset, ſatisfaction"))
  ; always LONG s before hyphen
  (check-equal? (html-magick "Shafts-bury") '(div [[class "antique"]] "Shaftſ-bury"))
  ; always round s before k or b (17th-century rules)
  (check-equal? (html-magick "ask, husband") '(div [[class "antique"]] "ask, husband"))
  ; always 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"))))))