Scribble: fix multi-line print output
Closes PR 11735 original commit: 1a5f41fd712384b409c760d15961af7b83e000ff
This commit is contained in:
parent
55de128d83
commit
8ce5125d6c
|
@ -113,7 +113,7 @@
|
||||||
#f
|
#f
|
||||||
(map (lambda (l)
|
(map (lambda (l)
|
||||||
(list (make-flow (list l))))
|
(list (make-flow (list l))))
|
||||||
flow-accum))))))))]
|
(reverse flow-accum)))))))))]
|
||||||
[(equal? #\newline v)
|
[(equal? #\newline v)
|
||||||
(loop #f #f (add-line (add-string string-accum line-accum)
|
(loop #f #f (add-line (add-string string-accum line-accum)
|
||||||
flow-accum))]
|
flow-accum))]
|
||||||
|
|
35
collects/tests/scribble/docs.rkt
Normal file
35
collects/tests/scribble/docs.rkt
Normal 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")
|
21
collects/tests/scribble/docs/print-lines.scrbl
Normal file
21
collects/tests/scribble/docs/print-lines.scrbl
Normal 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 ()))]
|
18
collects/tests/scribble/docs/print-lines.txt
Normal file
18
collects/tests/scribble/docs/print-lines.txt
Normal 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 ()))
|
Loading…
Reference in New Issue
Block a user