adjust scribble's racketblock renderer so that #true and #false

don't turn into #t and #f.
This commit is contained in:
Robby Findler 2011-04-30 20:34:41 -05:00
parent 4990029922
commit c8d476c76e
3 changed files with 34 additions and 6 deletions

View File

@ -209,12 +209,19 @@
(memq (syntax-e c) (current-variable-list)))]
[(s it? sub?)
(let ([sc (syntax-e c)])
(let ([s (or (syntax-property c 'display-string)
(format "~s" (if (literal-syntax? sc)
(literal-syntax-stx sc)
(if (var-id? sc)
(var-id-sym sc)
sc))))])
(let ([s (cond
[(syntax-property c 'display-string) => values]
[(literal-syntax? sc) (format "~s" (literal-syntax-stx sc))]
[(var-id? sc) (format "~s" (var-id-sym sc))]
[(eq? sc #t)
(if (equal? (syntax-span c) 5)
"#true"
"#t")]
[(eq? sc #f)
(if (equal? (syntax-span c) 6)
"#false"
"#f")]
[else (format "~s" sc)])])
(if (and (symbol? sc)
((string-length s) . > . 1)
(char=? (string-ref s 0) #\_)

View File

@ -0,0 +1,13 @@
#lang scribble/manual
@(require scribble/manual)
@; test that various alternatives in reader syntax get
@; turned into the right things when rendered
@racketblock[#t
#true
#f
#false
(a . < . b)
(< a b)
"abcdef"
([{}])]

View File

@ -0,0 +1,8 @@
#t
#true
#f
#false
(a . < . b)
(< a b)
"abcdef"
([{}])