Scribble: fix multi-line print output

Closes PR 11735

original commit: 1a5f41fd712384b409c760d15961af7b83e000ff
This commit is contained in:
Matthew Flatt 2011-02-14 07:12:14 -07:00
parent 55de128d83
commit 8ce5125d6c
4 changed files with 75 additions and 1 deletions

View File

@ -113,7 +113,7 @@
#f
(map (lambda (l)
(list (make-flow (list l))))
flow-accum))))))))]
(reverse flow-accum)))))))))]
[(equal? #\newline v)
(loop #f #f (add-line (add-string string-accum line-accum)
flow-accum))]

View File

@ -0,0 +1,35 @@
#lang racket/base
;; Use text renderer to check some Scribble functionality
;; ----------------------------------------
(require scribble/base-render
racket/file
racket/class
(prefix-in text: scribble/text-render))
(define (build-text-doc src-file dest-file)
(define dir (find-system-path 'temp-dir))
(let ([renderer (new (text:render-mixin render%)
[dest-dir dir])])
(let* ([docs (list (dynamic-require `(file ,src-file) 'doc))]
[fns (list (build-path dir dest-file))]
[fp (send renderer traverse docs fns)]
[info (send renderer collect docs fns fp)])
(let ([r-info (send renderer resolve docs fns info)])
(send renderer render docs fns r-info)))))
(define (check-text-build name)
(define src-file (string-append "docs/" name ".scrbl"))
(define expect-file (string-append "docs/" name ".txt"))
(build-text-doc src-file "gen.txt")
(unless (string=? (file->string expect-file)
(file->string (build-path (find-system-path 'temp-dir)
"gen.txt")))
(error 'check-text-build "mismatch from: ~e expected: ~e"
src-file expect-file)))
;; ----------------------------------------
(check-text-build "print-lines")

View File

@ -0,0 +1,21 @@
#lang scribble/manual
@(require scribble/eval)
@title{Pretty-Print-Handler Bug Example}
@(define the-eval (make-base-eval))
@(interaction-eval
#:eval the-eval
(begin
(require racket/pretty)
(current-print pretty-print-handler)))
@examples[#:eval the-eval
'((x "positional 1")
(rest ("positional 2" "positional 3"))
(a ())
(b ("b-arg"))
(c (("first c1" "second c1") ("first c2" "second c2")))
(d #f)
(e ()))]

View File

@ -0,0 +1,18 @@
Pretty-Print-Handler Bug Example
Example:
> '((x "positional 1")
(rest ("positional 2" "positional 3"))
(a ())
(b ("b-arg"))
(c (("first c1" "second c1") ("first c2" "second c2")))
(d #f)
(e ()))
'((x "positional 1")
(rest ("positional 2" "positional 3"))
(a ())
(b ("b-arg"))
(c (("first c1" "second c1") ("first c2" "second c2")))
(d #f)
(e ()))