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))
(cdr f)))))
(define/override (render-intrapara-block p part ri first? last? starting-item?)
(unless first? (indented-newline))
(super render-intrapara-block p part ri first? last? starting-item?))
@ -110,7 +109,7 @@
(when indent? (indent))
(for/fold ([space? #f]) ([col (in-list sub-row)]
[w (in-list widths)])
(when space? (display " "))
; (when space? (display " "))
(let ([col (if (eq? col 'cont)
""
col)])
@ -173,6 +172,17 @@
(parameterize ([current-preserve-spaces #t])
(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)
(cond

View File

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

View File

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

View File

@ -1,17 +1,17 @@
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 ()))
> '((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 ()))

View File

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