commit d3734342412792107bd54148d19c09c1d4ae352e parent f3e1a7425c8a7e55b1defec6479adf6b2f8c481e Author: Matthew Flatt <mflatt@racket-lang.org> Date: Fri, 21 Sep 2012 07:37:30 -0600 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. original commit: cb041850f424644937c8b494c64c066bbe5f2069 Diffstat:
8 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/collects/scribble/core.rkt b/collects/scribble/core.rkt @@ -107,6 +107,7 @@ [ldquo . #t] [rdquo . #t] [rsquo . #t] + [lsquo . #t] [prime . #t] [rarr . #t] [larr . #t] diff --git a/collects/scribble/decode.rkt b/collects/scribble/decode.rkt @@ -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. diff --git a/collects/scribble/latex-render.rkt b/collects/scribble/latex-render.rkt @@ -729,6 +729,7 @@ [(ldquo) "{``}"] [(rdquo) "{''}"] [(rsquo) "{'}"] + [(lsquo) "{`}"] [(prime) "$'$"] [(rarr) "$\\rightarrow$"] [(larr) "$\\leftarrow$"] diff --git a/collects/scribble/text-render.rkt b/collects/scribble/text-render.rkt @@ -162,6 +162,7 @@ [(ndash) "\U2013"] [(ldquo) "\U201C"] [(rdquo) "\U201D"] + [(lsquo) "\U2018"] [(rsquo) "\U2019"] [(lang) ">"] [(rang) "<"] diff --git a/collects/scribblings/scribble/core.scrbl b/collects/scribblings/scribble/core.scrbl @@ -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).} diff --git a/collects/scribblings/scribble/decode.scrbl b/collects/scribblings/scribble/decode.scrbl @@ -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 diff --git a/collects/tests/scribble/docs/decode.scrbl b/collects/tests/scribble/docs/decode.scrbl @@ -0,0 +1,4 @@ +#lang scribble/base + +``To make your so--so document look `pretty,' use fancy quotes,'' he +said---with practically audible quotes. diff --git a/collects/tests/scribble/docs/decode.txt b/collects/tests/scribble/docs/decode.txt @@ -0,0 +1,2 @@ +“To make your so–so document look ‘pretty,’ use fancy quotes,” he +said—with practically audible quotes.