tweaks to xrefs

master
Matthew Butterick 7 years ago
parent 339f979b1b
commit 75221f19f6

@ -15,7 +15,7 @@ I live in Los Angeles with my wife Jessica and Roxy the boxer.
You can reach me at link["mailto:mb@typographyforlawyers.com"]{mb@typographyforlawyers.com}. I welcome comments and corrections. I do not, however, dispense individualized critiques or recommendations. Nor do I have Word templates to give away. After all, the point of the book is for you to learn how to do these things yourself. You can reach me at link["mailto:mb@typographyforlawyers.com"]{mb@typographyforlawyers.com}. I welcome comments and corrections. I do not, however, dispense individualized critiques or recommendations. Nor do I have Word templates to give away. After all, the point of the book is for you to learn how to do these things yourself.
em{Typography for Lawyers} is © 200816 Matthew Butterick. All rights reserved. em{Typography for Lawyers} is © 200817 Matthew Butterick. All rights reserved.
gap[5] gap[5]

@ -7,7 +7,7 @@ If this book were a law-school class, reformatting a ◊em{caption page} could b
(omission) (omission)
Recall the second xref{maxim of page layout} em{divide the page into foreground and background}. The vertical rules on a caption page should seem like part of the backgroundthey should not be darker or more prominent than the body text in the foreground. Removing unnecessary rules will make the body text area feel less cramped. Use as few as possible. In this revised version, I removed the vertical rule on the right and one on the left. I made the remaining rule thinner and moved it away from the text. Recall the second xref["maxims-of-page-layout.html"]{maxim of page layout} em{divide the page into foreground and background}. The vertical rules on a caption page should seem like part of the backgroundthey should not be darker or more prominent than the body text in the foreground. Removing unnecessary rules will make the body text area feel less cramped. Use as few as possible. In this revised version, I removed the vertical rule on the right and one on the left. I made the remaining rule thinner and moved it away from the text.
Court filings have ugly typography as a matter of habit, not requirement. Court rules can be strict, but theres still plenty of room for good typography (see xref{how to interpret court rules}). Court filings have ugly typography as a matter of habit, not requirement. Court rules can be strict, but theres still plenty of room for good typography (see xref{how to interpret court rules}).

@ -537,18 +537,19 @@ Well, almost. One wrinkle that arises is connecting singular and plural versions
@chunk[<target->url> @chunk[<target->url>
(define (format-as-filename target) (define (format-as-filename target)
(define nonbreaking-space (string #\u00A0)) (define nonbreaking-space (string #\u00A0))
(let* ([x target] (let* ([x target]
[x (string-trim x "?")] ; delete a question mark at the end [x (string-trim x "?")] ; delete a question mark at the end
[x (string-downcase x)] ; put string in all lowercase [x (string-downcase x)] ; put string in all lowercase
[x (regexp-replace* #rx"é" x "e")] ; remove accented é [x (regexp-replace* #rx"é" x "e")] ; remove accented é
[x (if (regexp-match "times new roman" x) "a-brief-history-of-times-new-roman" x)] ; special rule for TNR [x (if (regexp-match "times new roman" x) "a-brief-history-of-times-new-roman" x)] ; special rule for TNR
[x (if (regexp-match "foreword" x) "foreword" x)] ; special rule for foreword [x (if (regexp-match "about the author" x) "about" x)] ; special rule for about
[x (if (regexp-match "table of contents" x) "toc" x)] ; special rule for toc [x (if (regexp-match "foreword" x) "foreword" x)] ; special rule for foreword
[x (string-replace x nonbreaking-space "-")] ; replace nbsp with hyphen [x (if (regexp-match "table of contents" x) "toc" x)] ; special rule for toc
[x (string-replace x " " "-")]) ; replace word space with hyphen [x (string-replace x nonbreaking-space "-")] ; replace nbsp with hyphen
(format "~a.html" x))) [x (string-replace x " " "-")]) ; replace word space with hyphen
(format "~a.html" x)))
(define (target->url target) (define (target->url target)
(define actual-filenames (define actual-filenames
@ -557,10 +558,11 @@ Well, almost. One wrinkle that arises is connecting singular and plural versions
[singular-target (regexp-replace plural-regex target "")] [singular-target (regexp-replace plural-regex target "")]
[plural-target (string-append singular-target "s")]) [plural-target (string-append singular-target "s")])
(list singular-target plural-target))) (list singular-target plural-target)))
(for*/first ([tfn (in-list (map format-as-filename target-variants))] (or (for*/first ([tfn (in-list (map format-as-filename target-variants))]
[afn (in-list actual-filenames)] [afn (in-list actual-filenames)]
#:when (equal? tfn afn)) #:when (equal? tfn afn))
tfn))] tfn)
(error (format "no URL found for ~a" target))))]
@defproc[ @defproc[