Scribble: fixes for text output, especially inset nested flows

original commit: d00c8a6c71c9f31c0e919014c42ed1b659103d9b
This commit is contained in:
Matthew Flatt 2011-03-30 19:53:32 -06:00
parent adbef370d3
commit 96abeaed70
5 changed files with 37 additions and 27 deletions

View File

@ -71,7 +71,6 @@
(render-block p part ht #f)) (render-block p part ht #f))
(cdr f))))) (cdr f)))))
(define/override (render-intrapara-block p part ri first? last? starting-item?) (define/override (render-intrapara-block p part ri first? last? starting-item?)
(unless first? (indented-newline)) (unless first? (indented-newline))
(super render-intrapara-block p part ri first? last? starting-item?)) (super render-intrapara-block p part ri first? last? starting-item?))
@ -110,7 +109,7 @@
(when indent? (indent)) (when indent? (indent))
(for/fold ([space? #f]) ([col (in-list sub-row)] (for/fold ([space? #f]) ([col (in-list sub-row)]
[w (in-list widths)]) [w (in-list widths)])
(when space? (display " ")) ; (when space? (display " "))
(let ([col (if (eq? col 'cont) (let ([col (if (eq? col 'cont)
"" ""
col)]) col)])
@ -173,6 +172,17 @@
(parameterize ([current-preserve-spaces #t]) (parameterize ([current-preserve-spaces #t])
(super render-content i part ri)) (super render-content i part ri))
(super render-content i part ri))) (super render-content i part ri)))
(define/override (render-nested-flow i part ri)
(let ([s (nested-flow-style i)])
(if (and s
(or (eq? (style-name s) 'inset)
(eq? (style-name s) 'code-inset)))
(begin
(printf " ")
(parameterize ([current-indent (make-indent 2)])
(super render-nested-flow i part ri)))
(super render-nested-flow i part ri))))
(define/override (render-other i part ht) (define/override (render-other i part ht)
(cond (cond

View File

@ -1,4 +1,4 @@
quote quote
  @itemlist[#:style 'ordered @itemlist[#:style 'ordered
            @item{Eat cookie.}]           @item{Eat cookie.}]

View File

@ -1,3 +1,3 @@
Example: Example:
  > #f > #f
  #f #f

View File

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

View File

@ -14,18 +14,18 @@ text to be generated programmatically.
Heres some Racket code: Heres some Racket code:
  (define half (lambda (x) (define half (lambda (x)
                 (x x)))                (x x)))
  (x x) (x x)
1.2. Another Subsection 1.2. Another Subsection
 (require racket/base)  (require racket/base)
(cons car cdr) -> stuff? (cons car cdr) -> stuff?
   car   :   (or/c #f   car : (or/c #f
      other?)       other?)
  cdr : any?   cdr : any?
Ok? Ok?