scribble: decode a lone ` as a left "curly quote"
Also, add 'lsquo as allowed content. Omitting the ` conversion in the first place was over-conservative. There's a backward-compatibility issue with this addition (i.e., a document might contain a backquote in a decoded context that is meant to be rendered as a backquote), but the potential problems seem minor.
This commit is contained in:
parent
c75c0d9946
commit
cb041850f4
|
@ -107,6 +107,7 @@
|
|||
[ldquo . #t]
|
||||
[rdquo . #t]
|
||||
[rsquo . #t]
|
||||
[lsquo . #t]
|
||||
[prime . #t]
|
||||
[rarr . #t]
|
||||
[larr . #t]
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
|
||||
|
||||
(define (decode-string s)
|
||||
(define pattern #rx"(---|--|``|''|')")
|
||||
(define pattern #rx"(---|--|``|''|'|`)")
|
||||
(let loop ([start 0])
|
||||
(cond
|
||||
[(regexp-match-positions pattern s start)
|
||||
|
@ -117,7 +117,8 @@
|
|||
[(string=? the-match "--") 'ndash]
|
||||
[(string=? the-match "``") 'ldquo]
|
||||
[(string=? the-match "''") 'rdquo]
|
||||
[(string=? the-match "'") 'rsquo])
|
||||
[(string=? the-match "'") 'rsquo]
|
||||
[(string=? the-match "`") 'lsquo])
|
||||
(loop (cdar m))))]
|
||||
;; Common case: nothing to decode, so don't copy strings.
|
||||
;; Assume that the input is already interned.
|
||||
|
|
|
@ -729,6 +729,7 @@
|
|||
[(ldquo) "{``}"]
|
||||
[(rdquo) "{''}"]
|
||||
[(rsquo) "{'}"]
|
||||
[(lsquo) "{`}"]
|
||||
[(prime) "$'$"]
|
||||
[(rarr) "$\\rightarrow$"]
|
||||
[(larr) "$\\leftarrow$"]
|
||||
|
|
|
@ -162,6 +162,7 @@
|
|||
[(ndash) "\U2013"]
|
||||
[(ldquo) "\U201C"]
|
||||
[(rdquo) "\U201D"]
|
||||
[(lsquo) "\U2018"]
|
||||
[(rsquo) "\U2019"]
|
||||
[(lang) ">"]
|
||||
[(rang) "<"]
|
||||
|
|
|
@ -137,7 +137,7 @@ A @deftech{block} is either a @techlink{table}, an
|
|||
|
||||
@item{A symbol content is either @racket['mdash],
|
||||
@racket['ndash], @racket['ldquo],
|
||||
@racket['lsquo], @racket['rsquo], @racket['larr],
|
||||
@racket['lsquo], @racket['rdquo], @racket['rsquo], @racket['larr],
|
||||
@racket['rarr], or @racket['prime]; it is
|
||||
rendered as the corresponding HTML entity
|
||||
(even for Latex output).}
|
||||
|
|
|
@ -28,6 +28,8 @@ makes just a few special text conversions:
|
|||
|
||||
@item{@litchar{'}: converted to @racket['rsquo], which is a fancy apostrophe: '}
|
||||
|
||||
@item{@litchar{`}: converted to @racket['lsquo], which is a fancy quote: `}
|
||||
|
||||
]
|
||||
|
||||
Some functions @deftech{decode} a sequence of @racket[_pre-flow] or
|
||||
|
|
4
collects/tests/scribble/docs/decode.scrbl
Normal file
4
collects/tests/scribble/docs/decode.scrbl
Normal file
|
@ -0,0 +1,4 @@
|
|||
#lang scribble/base
|
||||
|
||||
``To make your so--so document look `pretty,' use fancy quotes,'' he
|
||||
said---with practically audible quotes.
|
2
collects/tests/scribble/docs/decode.txt
Normal file
2
collects/tests/scribble/docs/decode.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
“To make your so–so document look ‘pretty,’ use fancy quotes,” he
|
||||
said—with practically audible quotes.
|
Loading…
Reference in New Issue
Block a user