tweaks to Danny's Scribble changes

This commit is contained in:
Matthew Flatt 2012-06-28 08:57:58 -06:00
parent d926f89cbe
commit 130618e946
2 changed files with 20 additions and 7 deletions

View File

@ -584,16 +584,28 @@
(content->port op (part-relative-element-content c ri) renderer sec ri)]
[else (content->port op c)])]))
(define (simple-content->string c)
;; `content->string' is commonly used on a list containing a single string
(cond
[(string? c) c]
[(and (pair? c)
(string? (car c))
(null? (cdr c)))
(car c)]
[else #f]))
(define content->string
(case-lambda
[(c)
(define op (open-output-string))
(content->port op c)
(get-output-string op)]
(or (simple-content->string c)
(let ([op (open-output-string)])
(content->port op c)
(get-output-string op)))]
[(c renderer sec ri)
(define op (open-output-string))
(content->port op c renderer sec ri)
(get-output-string op)]))
(or (simple-content->string c)
(let ([op (open-output-string)])
(content->port op c renderer sec ri)
(get-output-string op)))]))
(define (aux-element? e)

View File

@ -109,8 +109,9 @@
[(string=? the-match "'") 'rsquo])
(loop (cdar m))))]
;; Common case: nothing to decode, so don't copy strings.
;; Assume that the input is already interned.
[(= start 0)
(list (datum-intern-literal s))]
(list s)]
[else
(list (datum-intern-literal (substring s start)))])))