add compound-paragraphs to Scribble, improve Latex rendering for unnested single-column tables
svn: r15378
This commit is contained in:
parent
3e63caa887
commit
bcfb69b21f
|
@ -242,32 +242,37 @@
|
|||
(add-current-tag-prefix t))))))
|
||||
|
||||
(define/public (collect-content c ci)
|
||||
(for ([i c]) (collect-element i ci)))
|
||||
(for ([i (in-list c)]) (collect-element i ci)))
|
||||
|
||||
(define/public (collect-paragraph p ci)
|
||||
(collect-content (paragraph-content p) ci))
|
||||
|
||||
(define/public (collect-flow p ci)
|
||||
(for ([p (flow-paragraphs p)])
|
||||
(for ([p (in-list (flow-paragraphs p))])
|
||||
(collect-block p ci)))
|
||||
|
||||
(define/public (collect-block p ci)
|
||||
(cond [(table? p) (collect-table p ci)]
|
||||
[(itemization? p) (collect-itemization p ci)]
|
||||
[(blockquote? p) (collect-blockquote p ci)]
|
||||
[(compound-paragraph? p) (collect-compound-paragraph p ci)]
|
||||
[(delayed-block? p) (void)]
|
||||
[else (collect-paragraph p ci)]))
|
||||
|
||||
(define/public (collect-table i ci)
|
||||
(for ([d (apply append (table-flowss i))])
|
||||
(for ([d (in-list (apply append (table-flowss i)))])
|
||||
(when (flow? d) (collect-flow d ci))))
|
||||
|
||||
(define/public (collect-itemization i ci)
|
||||
(for ([d (itemization-flows i)])
|
||||
(for ([d (in-list (itemization-flows i))])
|
||||
(collect-flow d ci)))
|
||||
|
||||
(define/public (collect-blockquote i ci)
|
||||
(for ([d (blockquote-paragraphs i)])
|
||||
(for ([d (in-list (blockquote-paragraphs i))])
|
||||
(collect-block d ci)))
|
||||
|
||||
(define/public (collect-compound-paragraph i ci)
|
||||
(for ([d (in-list (compound-paragraph-blocks i))])
|
||||
(collect-block d ci)))
|
||||
|
||||
(define/public (collect-element i ci)
|
||||
|
@ -315,7 +320,7 @@
|
|||
(resolve-part p ri))))
|
||||
|
||||
(define/public (resolve-content c d ri)
|
||||
(for ([i c])
|
||||
(for ([i (in-list c)])
|
||||
(resolve-element i d ri)))
|
||||
|
||||
(define/public (resolve-paragraph p d ri)
|
||||
|
@ -330,6 +335,7 @@
|
|||
[(table? p) (resolve-table p d ri)]
|
||||
[(itemization? p) (resolve-itemization p d ri)]
|
||||
[(blockquote? p) (resolve-blockquote p d ri)]
|
||||
[(compound-paragraph? p) (resolve-compound-paragraph p d ri)]
|
||||
[(delayed-block? p)
|
||||
(let ([v ((delayed-block-resolve p) this d ri)])
|
||||
(hash-set! (resolve-info-delays ri) p v)
|
||||
|
@ -337,15 +343,19 @@
|
|||
[else (resolve-paragraph p d ri)]))
|
||||
|
||||
(define/public (resolve-table i d ri)
|
||||
(for ([f (apply append (table-flowss i))])
|
||||
(for ([f (in-list (apply append (table-flowss i)))])
|
||||
(when (flow? f) (resolve-flow f d ri))))
|
||||
|
||||
(define/public (resolve-itemization i d ri)
|
||||
(for ([f (itemization-flows i)])
|
||||
(for ([f (in-list (itemization-flows i))])
|
||||
(resolve-flow f d ri)))
|
||||
|
||||
(define/public (resolve-blockquote i d ri)
|
||||
(for ([f (blockquote-paragraphs i)])
|
||||
(for ([f (in-list (blockquote-paragraphs i))])
|
||||
(resolve-block f d ri)))
|
||||
|
||||
(define/public (resolve-compound-paragraph i d ri)
|
||||
(for ([f (in-list (compound-paragraph-blocks i))])
|
||||
(resolve-block f d ri)))
|
||||
|
||||
(define/public (resolve-element i d ri)
|
||||
|
@ -415,6 +425,15 @@
|
|||
(define/public (render-paragraph p part ri)
|
||||
(render-content (paragraph-content p) part ri))
|
||||
|
||||
(define/public (render-compound-paragraph p part ri)
|
||||
(apply append (let loop ([l (compound-paragraph-blocks p)]
|
||||
[first? #t])
|
||||
(cond
|
||||
[(null? l) null]
|
||||
[else (cons
|
||||
(render-intrapara-block (car l) part ri first? (null? (cdr l)))
|
||||
(loop (cdr l) #f))]))))
|
||||
|
||||
(define/public (render-flow p part ri start-inline?)
|
||||
(if (null? (flow-paragraphs p))
|
||||
null
|
||||
|
@ -426,6 +445,9 @@
|
|||
(render-block p part ri #f))
|
||||
(cdr (flow-paragraphs p)))))))
|
||||
|
||||
(define/public (render-intrapara-block p part ri first? last?)
|
||||
(render-block p part ri first?))
|
||||
|
||||
(define/public (render-block p part ri inline?)
|
||||
(cond
|
||||
[(table? p) (if (auxiliary-table? p)
|
||||
|
@ -433,6 +455,7 @@
|
|||
(render-table p part ri inline?))]
|
||||
[(itemization? p) (render-itemization p part ri)]
|
||||
[(blockquote? p) (render-blockquote p part ri)]
|
||||
[(compound-paragraph? p) (render-compound-paragraph p part ri)]
|
||||
[(delayed-block? p)
|
||||
(render-block (delayed-block-blocks p ri) part ri inline?)]
|
||||
[else (render-paragraph p part ri)]))
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
decode-part
|
||||
decode-flow
|
||||
decode-paragraph
|
||||
decode-compound-paragraph
|
||||
decode-content
|
||||
(rename-out [decode-content decode-elements])
|
||||
decode-string
|
||||
|
@ -63,8 +64,8 @@
|
|||
|
||||
(define (decode-accum-para accum)
|
||||
(if (andmap whitespace? accum)
|
||||
null
|
||||
(list (decode-paragraph (reverse (skip-whitespace accum))))))
|
||||
null
|
||||
(list (decode-compound-paragraph (reverse (skip-whitespace accum))))))
|
||||
|
||||
(define (part-version p)
|
||||
(if (versioned-part? p)
|
||||
|
@ -117,6 +118,8 @@
|
|||
(title-decl-tags (car l))
|
||||
(title-decl-version (car l))
|
||||
(title-decl-style (car l)))])]
|
||||
#;
|
||||
;; Blocks are now handled by decode-accum-para
|
||||
[(block? (car l))
|
||||
(let ([para (decode-accum-para accum)]
|
||||
[part (decode-flow* (cdr l) keys colls tag-prefix tags vers style
|
||||
|
@ -248,3 +251,30 @@
|
|||
(define (decode-content l)
|
||||
(append-map (lambda (s) (if (string? s) (decode-string s) (list s)))
|
||||
(skip-whitespace l)))
|
||||
|
||||
(define (decode-compound-paragraph l)
|
||||
(define (finish-accum para-accum)
|
||||
(if (null? para-accum)
|
||||
null
|
||||
(list (make-paragraph (skip-whitespace (apply append (reverse para-accum)))))))
|
||||
(let ([r (let loop ([l (skip-whitespace l)]
|
||||
[para-accum null])
|
||||
(cond
|
||||
[(null? l)
|
||||
(finish-accum para-accum)]
|
||||
[else
|
||||
(let ([s (car l)])
|
||||
(cond
|
||||
[(block? s) (append
|
||||
(finish-accum para-accum)
|
||||
(cons s (loop (skip-whitespace (cdr l)) null)))]
|
||||
[(string? s) (loop (cdr l)
|
||||
(cons (decode-string s) para-accum))]
|
||||
[else (loop (cdr l)
|
||||
(cons (list (car l)) para-accum))]))]))])
|
||||
(cond
|
||||
[(null? r)
|
||||
(make-paragraph null)]
|
||||
[(null? (cdr r))
|
||||
(car r)]
|
||||
[(make-compound-paragraph #f r)])))
|
||||
|
|
|
@ -392,8 +392,9 @@
|
|||
(syntax-rules ()
|
||||
[(_ #:eval ev def e ...)
|
||||
(let ([eva ev])
|
||||
(make-splice (list (schemeblock+eval #:eval eva def)
|
||||
(interaction #:eval eva e ...))))]
|
||||
(column (list (schemeblock+eval #:eval eva def)
|
||||
blank-line
|
||||
(interaction #:eval eva e ...))))]
|
||||
[(_ def e ...)
|
||||
(def+int #:eval (make-base-eval) def e ...)]))
|
||||
|
||||
|
@ -401,8 +402,9 @@
|
|||
(syntax-rules ()
|
||||
[(_ #:eval ev [def ...] e ...)
|
||||
(let ([eva ev])
|
||||
(make-splice (list (schemeblock+eval #:eval eva def ...)
|
||||
(interaction #:eval eva e ...))))]
|
||||
(column (list (schemeblock+eval #:eval eva def ...)
|
||||
blank-line
|
||||
(interaction #:eval eva e ...))))]
|
||||
[(_ [def ...] e ...)
|
||||
(defs+int #:eval (make-base-eval) [def ...] e ...)]))
|
||||
|
||||
|
@ -441,6 +443,14 @@
|
|||
[(_ example-title e ...)
|
||||
(titled-interaction example-title schemedefinput* e ...)]))
|
||||
|
||||
(define blank-line (make-paragraph (list 'nbsp)))
|
||||
|
||||
(define (column l)
|
||||
(make-table #f (map
|
||||
(lambda (t)
|
||||
(list (make-flow (list t))))
|
||||
l)))
|
||||
|
||||
(define (do-splice l)
|
||||
(cond
|
||||
[(null? l) null]
|
||||
|
|
|
@ -506,6 +506,8 @@
|
|||
(append-map flow-targets (itemization-flows e))]
|
||||
[(blockquote? e)
|
||||
(append-map block-targets (blockquote-paragraphs e))]
|
||||
[(compound-paragraph? e)
|
||||
(append-map block-targets (compound-paragraph-blocks e))]
|
||||
[(delayed-block? e) null]))
|
||||
(define (para-targets para)
|
||||
(let loop ([c (paragraph-content para)])
|
||||
|
@ -851,7 +853,7 @@
|
|||
(define/override (render-flow p part ri start-inline?)
|
||||
(render-flow* p part ri start-inline? #t))
|
||||
|
||||
(define/override (render-paragraph p part ri)
|
||||
(define/private (do-render-paragraph p part ri flatten-unstyled?)
|
||||
;; HACK: for the search, we need to be able to render a `div'
|
||||
;; with an `id' attribute, `p' will probably work fine instead
|
||||
;; of `div' since it's a block element. Do this for now.
|
||||
|
@ -861,13 +863,25 @@
|
|||
[style (if (with-attributes? raw-style)
|
||||
(with-attributes-style raw-style)
|
||||
raw-style)])
|
||||
`((,(if (eq? style 'div) 'div 'p)
|
||||
,(append
|
||||
(if (string? style)
|
||||
`([class ,style])
|
||||
`())
|
||||
(style->attribs raw-style))
|
||||
,@contents))))
|
||||
(if (and flatten-unstyled?
|
||||
(not style))
|
||||
contents
|
||||
`((,(if (eq? style 'div) 'div 'p)
|
||||
,(append
|
||||
(if (string? style)
|
||||
`([class ,style])
|
||||
`())
|
||||
(style->attribs raw-style))
|
||||
,@contents)))))
|
||||
|
||||
(define/override (render-paragraph p part ri)
|
||||
(do-render-paragraph p part ri #f))
|
||||
|
||||
(define/override (render-intrapara-block p part ri first? last?)
|
||||
`((div ([class "SIntrapara"])
|
||||
,@(cond
|
||||
[(paragraph? p) (do-render-paragraph p part ri #t)]
|
||||
[else (render-block p part ri #t)]))))
|
||||
|
||||
(define/override (render-element e part ri)
|
||||
(cond
|
||||
|
@ -1118,7 +1132,7 @@
|
|||
[(centered) '([align "center"])]
|
||||
[(at-right) '([align "right"])]
|
||||
[(at-left) '([align "left"])]
|
||||
[else null])
|
||||
[else '()])
|
||||
,@(let ([a (t-style-get 'style)])
|
||||
(if (and a (string? (cadr a))) `([class ,(cadr a)]) null))
|
||||
,@(if (string? t-style) `([class ,t-style]) null)
|
||||
|
@ -1137,6 +1151,12 @@
|
|||
,@(append-map (lambda (i) (render-block i part ri #f))
|
||||
(blockquote-paragraphs t)))))
|
||||
|
||||
(define/override (render-compound-paragraph t part ri)
|
||||
`((p ,(if (string? (compound-paragraph-style t))
|
||||
`([class ,(regexp-replace #rx"^[\\]" (compound-paragraph-style t) "")])
|
||||
`())
|
||||
,@(super render-compound-paragraph t part ri))))
|
||||
|
||||
(define/override (render-itemization t part ri)
|
||||
(let ([style-str (and (styled-itemization? t)
|
||||
(string? (styled-itemization-style t))
|
||||
|
|
|
@ -130,6 +130,12 @@
|
|||
(when (string? style) (printf "}"))))
|
||||
null)
|
||||
|
||||
(define/override (render-intrapara-block p part ri first? last?)
|
||||
(unless first?
|
||||
(printf "\n\n\\noindent "))
|
||||
(begin0
|
||||
(super render-intrapara-block p part ri first? last?)))
|
||||
|
||||
(define/override (render-element e part ri)
|
||||
(when (render-element? e)
|
||||
((render-element-render e) this part ri))
|
||||
|
@ -274,85 +280,96 @@
|
|||
[boxline "{\\setlength{\\unitlength}{\\linewidth}\\begin{picture}(1,0)\\put(0,0){\\line(1,0){1}}\\end{picture}}"]
|
||||
[twidth (if (null? (table-flowss t))
|
||||
1
|
||||
(length (car (table-flowss t))))])
|
||||
(unless (or (null? flowss) (null? (car flowss)))
|
||||
(parameterize ([current-table-mode
|
||||
(if inline? (current-table-mode) (list tableform t))]
|
||||
[show-link-page-numbers
|
||||
(or index? (show-link-page-numbers))])
|
||||
(cond
|
||||
[index? (printf "\\begin{list}{}{\\parsep=0pt \\itemsep=1pt \\leftmargin=2ex \\itemindent=-2ex}\n")]
|
||||
[inline? (void)]
|
||||
[else
|
||||
(printf "~a~a\\begin{~a}~a{@{~a}~a}\n~a"
|
||||
(if (and inline-table? (equal? tableform "bigtabular"))
|
||||
"\\bigtableinlinecorrect"
|
||||
"")
|
||||
(if (string? (table-style t))
|
||||
(format "\\begin{~a}" (table-style t))
|
||||
"")
|
||||
tableform
|
||||
opt
|
||||
(if (equal? tableform "bigtabular")
|
||||
"\\bigtableleftpad"
|
||||
"")
|
||||
(string-append*
|
||||
(map (lambda (i align)
|
||||
(format "~a@{}"
|
||||
(case align
|
||||
[(center) "c"]
|
||||
[(right) "r"]
|
||||
[else "l"])))
|
||||
(car flowss)
|
||||
(cdr (or (and (list? (table-style t))
|
||||
(assoc 'alignment
|
||||
(or (table-style t) null)))
|
||||
(cons #f (map (lambda (x) #f)
|
||||
(car flowss)))))))
|
||||
(if boxed?
|
||||
(if (equal? tableform "bigtabular")
|
||||
(format "~a \\SEndFirstHead\n" boxline)
|
||||
(format "\\multicolumn{~a}{@{}l@{}}{~a} \\\\\n"
|
||||
(length (car flowss))
|
||||
boxline))
|
||||
""))])
|
||||
(let loop ([flowss flowss]
|
||||
[row-styles row-styles])
|
||||
(let ([flows (car flowss)]
|
||||
[row-style (car row-styles)])
|
||||
(let loop ([flows flows]
|
||||
[col-v-styles (or (and (list? row-style)
|
||||
(let ([p (assoc 'valignment row-style)])
|
||||
(and p (cdr p))))
|
||||
(let ([p (and (list? (table-style t))
|
||||
(assoc 'valignment (table-style t)))])
|
||||
(and p (cdr p))))])
|
||||
(unless (null? flows)
|
||||
(when index? (printf "\n\\item "))
|
||||
(unless (eq? 'cont (car flows))
|
||||
(let ([cnt (let loop ([flows (cdr flows)][n 1])
|
||||
(cond [(null? flows) n]
|
||||
[(eq? (car flows) 'cont)
|
||||
(loop (cdr flows) (add1 n))]
|
||||
[else n]))])
|
||||
(unless (= cnt 1) (printf "\\multicolumn{~a}{l}{" cnt))
|
||||
(render-table-flow (car flows) part ri twidth (and col-v-styles
|
||||
(car col-v-styles)))
|
||||
(unless (= cnt 1) (printf "}"))
|
||||
(unless (null? (list-tail flows cnt)) (printf " &\n"))))
|
||||
(unless (null? (cdr flows)) (loop (cdr flows)
|
||||
(and col-v-styles (cdr col-v-styles))))))
|
||||
(unless (or index? (null? (cdr flowss)))
|
||||
(printf " \\\\\n")
|
||||
(when (equal? row-style "inferencetop") (printf "\\hline\n")))
|
||||
(unless (null? (cdr flowss))
|
||||
(loop (cdr flowss) (cdr row-styles)))))
|
||||
(unless inline?
|
||||
(printf "\\end{~a}~a"
|
||||
tableform
|
||||
(if (string? (table-style t))
|
||||
(format "\\end{~a}" (table-style t))
|
||||
""))))))
|
||||
(length (car (table-flowss t))))]
|
||||
[single-column? (and (= 1 twidth)
|
||||
(not (table-style t))
|
||||
(not (current-table-mode)))])
|
||||
(if single-column?
|
||||
(do-render-blockquote
|
||||
(make-blockquote "SingleColumn"
|
||||
(apply append (map flow-paragraphs (map car (table-flowss t)))))
|
||||
part
|
||||
ri
|
||||
#t)
|
||||
(unless (or (null? flowss) (null? (car flowss)))
|
||||
(parameterize ([current-table-mode
|
||||
(if inline? (current-table-mode) (list tableform t))]
|
||||
[show-link-page-numbers
|
||||
(or index? (show-link-page-numbers))])
|
||||
(cond
|
||||
[index? (printf "\\begin{list}{}{\\parsep=0pt \\itemsep=1pt \\leftmargin=2ex \\itemindent=-2ex}\n")]
|
||||
[inline? (void)]
|
||||
[single-column? (printf "\\begin{tabbing}\n")]
|
||||
[else
|
||||
(printf "~a~a\\begin{~a}~a{@{~a}~a}\n~a"
|
||||
(if (and inline-table? (equal? tableform "bigtabular"))
|
||||
"\\bigtableinlinecorrect"
|
||||
"")
|
||||
(if (string? (table-style t))
|
||||
(format "\\begin{~a}" (table-style t))
|
||||
"")
|
||||
tableform
|
||||
opt
|
||||
(if (equal? tableform "bigtabular")
|
||||
"\\bigtableleftpad"
|
||||
"")
|
||||
(string-append*
|
||||
(map (lambda (i align)
|
||||
(format "~a@{}"
|
||||
(case align
|
||||
[(center) "c"]
|
||||
[(right) "r"]
|
||||
[else "l"])))
|
||||
(car flowss)
|
||||
(cdr (or (and (list? (table-style t))
|
||||
(assoc 'alignment
|
||||
(or (table-style t) null)))
|
||||
(cons #f (map (lambda (x) #f)
|
||||
(car flowss)))))))
|
||||
(if boxed?
|
||||
(if (equal? tableform "bigtabular")
|
||||
(format "~a \\SEndFirstHead\n" boxline)
|
||||
(format "\\multicolumn{~a}{@{}l@{}}{~a} \\\\\n"
|
||||
(length (car flowss))
|
||||
boxline))
|
||||
""))])
|
||||
(let loop ([flowss flowss]
|
||||
[row-styles row-styles])
|
||||
(let ([flows (car flowss)]
|
||||
[row-style (car row-styles)])
|
||||
(let loop ([flows flows]
|
||||
[col-v-styles (or (and (list? row-style)
|
||||
(let ([p (assoc 'valignment row-style)])
|
||||
(and p (cdr p))))
|
||||
(let ([p (and (list? (table-style t))
|
||||
(assoc 'valignment (table-style t)))])
|
||||
(and p (cdr p))))])
|
||||
(unless (null? flows)
|
||||
(when index? (printf "\n\\item "))
|
||||
(unless (eq? 'cont (car flows))
|
||||
(let ([cnt (let loop ([flows (cdr flows)][n 1])
|
||||
(cond [(null? flows) n]
|
||||
[(eq? (car flows) 'cont)
|
||||
(loop (cdr flows) (add1 n))]
|
||||
[else n]))])
|
||||
(unless (= cnt 1) (printf "\\multicolumn{~a}{l}{" cnt))
|
||||
(render-table-flow (car flows) part ri twidth (and col-v-styles
|
||||
(car col-v-styles)))
|
||||
(unless (= cnt 1) (printf "}"))
|
||||
(unless (null? (list-tail flows cnt)) (printf " &\n"))))
|
||||
(unless (null? (cdr flows)) (loop (cdr flows)
|
||||
(and col-v-styles (cdr col-v-styles))))))
|
||||
(unless (or index? (null? (cdr flowss)))
|
||||
(printf " \\\\\n")
|
||||
(when (equal? row-style "inferencetop") (printf "\\hline\n")))
|
||||
(unless (null? (cdr flowss))
|
||||
(loop (cdr flowss) (cdr row-styles)))))
|
||||
(unless inline?
|
||||
(printf "\\end{~a}~a"
|
||||
tableform
|
||||
(if (string? (table-style t))
|
||||
(format "\\end{~a}" (table-style t))
|
||||
"")))))))
|
||||
null)
|
||||
|
||||
(define/private (render-table-flow p part ri twidth vstyle)
|
||||
|
@ -413,18 +430,37 @@
|
|||
(printf "\\end{~a}" mode)
|
||||
null))
|
||||
|
||||
(define/override (render-blockquote t part ri)
|
||||
(define/private (do-render-blockquote t part ri single-column?)
|
||||
(let ([kind (or (blockquote-style t) "quote")])
|
||||
(if (regexp-match #rx"^[\\]" kind)
|
||||
(printf "~a{" kind)
|
||||
(printf "\\begin{~a}" kind))
|
||||
(parameterize ([current-table-mode (list "blockquote" t)])
|
||||
(parameterize ([current-table-mode (if single-column?
|
||||
(current-table-mode)
|
||||
(list "blockquote" t))])
|
||||
(render-flow (make-flow (blockquote-paragraphs t)) part ri #f))
|
||||
(if (regexp-match #rx"^[\\]" kind)
|
||||
(printf "}")
|
||||
(printf "\\end{~a}" kind))
|
||||
null))
|
||||
|
||||
(define/override (render-blockquote t part ri)
|
||||
(do-render-blockquote t part ri #f))
|
||||
|
||||
(define/override (render-compound-paragraph t part ri)
|
||||
(let ([kind (compound-paragraph-style t)])
|
||||
(when kind
|
||||
(if (regexp-match #rx"^[\\]" kind)
|
||||
(printf "~a{" kind)
|
||||
(printf "\\begin{~a}" kind)))
|
||||
(parameterize ([current-table-mode (list "blockquote" t)])
|
||||
(super render-compound-paragraph t part ri))
|
||||
(when kind
|
||||
(if (regexp-match #rx"^[\\]" kind)
|
||||
(printf "}")
|
||||
(printf "\\end{~a}" kind)))
|
||||
null))
|
||||
|
||||
(define/override (render-other i part ri)
|
||||
(cond
|
||||
[(string? i) (display-protected i)]
|
||||
|
|
|
@ -162,7 +162,7 @@
|
|||
|
||||
|
||||
(define (centerline . s)
|
||||
(make-table 'centered (list (list (make-flow (list (decode-paragraph s)))))))
|
||||
(make-blockquote "SCentered" (flow-paragraphs (decode-flow s))))
|
||||
|
||||
(define (commandline . s)
|
||||
(make-paragraph (cons (hspace 2) (map (lambda (s)
|
||||
|
|
|
@ -27,6 +27,11 @@
|
|||
|
||||
/* ---------------------------------------- */
|
||||
|
||||
p, .SIntrapara {
|
||||
display: block;
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
h2 { /* per-page main title */
|
||||
margin-top: 0;
|
||||
}
|
||||
|
@ -517,6 +522,10 @@ i {
|
|||
vertical-align: text-top;
|
||||
}
|
||||
|
||||
.SCentered {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.imageleft {
|
||||
float: left;
|
||||
margin-right: 0.3em;
|
||||
|
|
|
@ -97,6 +97,10 @@
|
|||
\newcommand{\atItemizeStart}[0]{\addtolength{\stabLeft}{\labelsep}
|
||||
\addtolength{\stabLeft}{\labelwidth}}
|
||||
|
||||
\newenvironment{SingleColumn}{\begin{list}{}{\topsep=0pt\partopsep=0pt%
|
||||
\listparindent=0pt\itemindent=0pt\labelwidth=0pt\leftmargin=0pt\rightmargin=0pt%
|
||||
\itemsep=0pt\parsep=0pt}\item}{\end{list}}
|
||||
|
||||
\newenvironment{schemeblock}{}{}
|
||||
\newenvironment{defmodule}{}{}
|
||||
\newenvironment{prototype}{}{}
|
||||
|
@ -113,6 +117,8 @@
|
|||
\newcommand{\subsectionhidden}[1]{\subsection{#1}}
|
||||
\newcommand{\subsubsectionhidden}[1]{\subsubsection{#1}}
|
||||
|
||||
\newenvironment{SCentered}{\begin{trivlist}\item \centering}{\end{trivlist}}
|
||||
|
||||
% Scribble then generates the following:
|
||||
%
|
||||
% \begin{document}
|
||||
|
|
|
@ -123,6 +123,7 @@
|
|||
(table? p)
|
||||
(itemization? p)
|
||||
(blockquote? p)
|
||||
(compound-paragraph? p)
|
||||
(delayed-block? p)))
|
||||
|
||||
(define (string-without-newline? s)
|
||||
|
@ -151,6 +152,8 @@
|
|||
[(styled-itemization itemization) ([style any/c])]
|
||||
[blockquote ([style any/c]
|
||||
[paragraphs (listof block?)])]
|
||||
[compound-paragraph ([style any/c]
|
||||
[blocks (listof block?)])]
|
||||
;; content = list of elements
|
||||
[element ([style any/c]
|
||||
[content list?])]
|
||||
|
@ -487,6 +490,7 @@
|
|||
[(table? p) (table-width p)]
|
||||
[(itemization? p) (itemization-width p)]
|
||||
[(blockquote? p) (blockquote-width p)]
|
||||
[(compound-paragraph? p) (compound-paragraph-width p)]
|
||||
[(delayed-block? p) 1]))
|
||||
|
||||
(define (table-width p)
|
||||
|
@ -503,7 +507,10 @@
|
|||
(apply max 0 (map flow-width (itemization-flows p))))
|
||||
|
||||
(define (blockquote-width p)
|
||||
(+ 4 (apply max 0 (map paragraph-width (blockquote-paragraphs p)))))
|
||||
(+ 4 (apply max 0 (map block-width (blockquote-paragraphs p)))))
|
||||
|
||||
(define (compound-paragraph-width p)
|
||||
(apply max 0 (map block-width (compound-paragraph-blocks p))))
|
||||
|
||||
;; ----------------------------------------
|
||||
|
||||
|
|
|
@ -41,12 +41,12 @@ extend or configure Scribble fall into two groups:
|
|||
|
||||
When a string is uses as a style in an @scheme[element],
|
||||
@scheme[styled-paragraph], @scheme[table],
|
||||
@scheme[styled-itemization], or @scheme[blockquote], it corresponds to
|
||||
@scheme[styled-itemization], @scheme[blockquote], or @scheme[compound-paragraph], it corresponds to
|
||||
a CSS class for HTML output or a Tex macro/environment for Latex
|
||||
output. In Latex output, the string is used as a command name for a
|
||||
@scheme[styled-paragraph] and an environment name for a
|
||||
@scheme[table], @scheme[itemization], or @scheme[blockquote], except
|
||||
that a @scheme[blockquote] style name that starts with @litchar{\} is
|
||||
@scheme[table], @scheme[itemization], @scheme[blockquote], or @scheme[compound-paragraph], except
|
||||
that a @scheme[blockquote] or @scheme[compound-paragraph] style name that starts with @litchar{\} is
|
||||
used (sans @litchar{\}) as a command instead of an environment.
|
||||
In addition, for an itemization, the style string is
|
||||
suffixed with @scheme["Item"] and used as a CSS class or Tex macro
|
||||
|
|
|
@ -11,8 +11,11 @@ stream of strings to produces instances of the
|
|||
@schememodname[scribble/struct] datatypes (see @secref["struct"]).}
|
||||
|
||||
At the @tech{flow} level, decoding recognizes a blank line as a
|
||||
@tech{paragraph} separator. At the @tech{paragraph}-content level,
|
||||
decoding makes just a few special text conversions:
|
||||
@tech{paragraph} separator. Blocks and paragraphs without blank lines
|
||||
in between are collected into a @tech{compound paragraph}.
|
||||
|
||||
At the @tech{paragraph}-content level, decoding makes just a few
|
||||
special text conversions:
|
||||
|
||||
@itemize[
|
||||
|
||||
|
@ -81,6 +84,14 @@ the enclosing flow.
|
|||
|
||||
}
|
||||
|
||||
@defproc[(decode-compound-paragraph [lst list?]) block?]{
|
||||
|
||||
Decodes a compound paragraph. If the compound paragraph contains a
|
||||
single block, the block is returned without a
|
||||
@scheme[compound-paragraph] wrapper.
|
||||
|
||||
}
|
||||
|
||||
@defproc[(decode-paragraph [lst list?]) paragraph?]{
|
||||
|
||||
Decodes a paragraph.
|
||||
|
@ -104,6 +115,7 @@ Decodes a single string to produce a list of elements.
|
|||
|
||||
}
|
||||
|
||||
|
||||
@defproc[(whitespace? [s string?]) boolean?]{
|
||||
|
||||
Returns @scheme[#t] if @scheme[s] contains only whitespace, @scheme[#f]
|
||||
|
|
|
@ -9,4 +9,4 @@
|
|||
the same as @schememodname[scribble/doclang], except that
|
||||
@scheme[read-syntax-inside] is used to read the body of the module. In
|
||||
other words, the module body starts in Scribble ``text'' mode instead
|
||||
of S-expression mode.}
|
||||
of S-expression mode.}
|
|
@ -10,9 +10,15 @@
|
|||
@title[#:tag "manual" #:style 'toc]{Manual Forms}
|
||||
|
||||
@defmodule[scribble/manual]{The @schememodname[scribble/manual]
|
||||
library provides all of @schememodname[scribble/basic], plus
|
||||
additional functions that are relatively specific to writing PLT
|
||||
Scheme documentation.}
|
||||
library provides all of @schememodname[scribble/basic] plus additional
|
||||
functions, including many that are relatively specific to writing PLT
|
||||
Scheme documentation.
|
||||
|
||||
The @schememodname[scribble/manual] name can also be used as a
|
||||
language with @hash-lang[]. It acts like the
|
||||
@schememodname[scribble/doc] language, except that the
|
||||
@schememodname[scribble/manual] library is also required into
|
||||
the module.}
|
||||
|
||||
@local-table-of-contents[]
|
||||
|
||||
|
@ -1075,6 +1081,8 @@ combination of @scheme[envvar] and @scheme[as-index].}
|
|||
@; ------------------------------------------------------------------------
|
||||
@section{Bibliography}
|
||||
|
||||
@margin-note{See also @schememodname[scriblib/autobib].}
|
||||
|
||||
@defproc[(cite [key string?]) element?]{
|
||||
|
||||
Links to a bibliography entry, using @scheme[key] both to indicate the
|
||||
|
|
|
@ -41,8 +41,8 @@ A @deftech{flow} is an instance of @scheme[flow]; it has a list of
|
|||
@techlink{blocks}.
|
||||
|
||||
A @deftech{block} is either a @techlink{table}, an
|
||||
@techlink{itemization}, @techlink{blockquote}, @techlink{paragraph},
|
||||
or a @techlink{delayed block}.
|
||||
@techlink{itemization}, a @techlink{blockquote}, a @techlink{paragraph},
|
||||
@techlink{compound paragraph}, or a @techlink{delayed block}.
|
||||
|
||||
@itemize[
|
||||
|
||||
|
@ -55,8 +55,9 @@ A @deftech{block} is either a @techlink{table}, an
|
|||
it has a list of @techlink{flows}.}
|
||||
|
||||
@item{A @deftech{blockquote} is an instance of
|
||||
@scheme[blockquote]; it has list of @tech{blocks}
|
||||
that are indented according to a specified style.}
|
||||
@scheme[blockquote]; it has list of @tech{blocks} that
|
||||
are typeset as sub-flow, and by default the subflow is
|
||||
inset.}
|
||||
|
||||
@item{A @deftech{paragraph} is an instance of
|
||||
@scheme[paragraph]; it has a @deftech{content}, which is
|
||||
|
@ -162,6 +163,12 @@ A @deftech{block} is either a @techlink{table}, an
|
|||
|
||||
]}]}
|
||||
|
||||
@item{A @deftech{compound paragraph} is an instance of
|
||||
@scheme[compound-paragraph]; like @scheme[blockquote], it
|
||||
has list of @tech{blocks}, but the blocks are typeset as
|
||||
a single paragraph (e.g., no indentation after the first
|
||||
block) instead of inset.}
|
||||
|
||||
@item{A @deftech{delayed block} is an instance of
|
||||
@scheme[delayed-block], which has a procedure that
|
||||
is called in the @techlink{resolve pass} of document
|
||||
|
@ -340,7 +347,7 @@ it is attached to a part representing the whole document. The default
|
|||
version for a document is @scheme[(version)].}
|
||||
|
||||
|
||||
@defstruct[flow ([paragraphs (listof flow-element?)])]{
|
||||
@defstruct[flow ([paragraphs (listof block?)])]{
|
||||
|
||||
A @techlink{flow} has a list of @tech{blocks}.
|
||||
|
||||
|
@ -396,8 +403,9 @@ output, individual paragraphs are not automatically line-wrapped; to
|
|||
get a line-wrapped paragraph, use an element with a string style and
|
||||
define a corresponding Latex macro in terms of @tt{parbox}. For Latex
|
||||
output of blocks in the flow that are @scheme[blockquote]s,
|
||||
@scheme[itemization]s, or @scheme[delayed-block]s, the block is
|
||||
wrapped with @tt{minipage} using @tt{linewidth} as the width.
|
||||
@scheme[itemization]s, @scheme[compound-paragraph]s, or
|
||||
@scheme[delayed-block]s, the block is wrapped with @tt{minipage} using
|
||||
@tt{linewidth} as the width.
|
||||
|
||||
The @scheme[style] can be any of the following:
|
||||
|
||||
|
@ -472,7 +480,7 @@ The @scheme[style] can be
|
|||
|
||||
|
||||
@defstruct[blockquote ([style any/c]
|
||||
[paragraphs (listof flow-element?)])]{
|
||||
[paragraphs (listof block?)])]{
|
||||
|
||||
A @techlink{blockquote} has a style and a list of @tech{blocks}. The
|
||||
@scheme[style] field is normally a string that corresponds to a CSS
|
||||
|
@ -482,7 +490,18 @@ leading @litchar{\} in the style name is treated specially (see
|
|||
|
||||
}
|
||||
|
||||
@defstruct[delayed-block ([resolve (any/c part? resolve-info? . -> . flow-element?)])]{
|
||||
@defstruct[compound-paragraph ([style any/c]
|
||||
[blocks (listof block?)])]{
|
||||
|
||||
A @techlink{compound paragraph} has a style and a list of @tech{blocks}. The
|
||||
@scheme[style] field is normally a string that corresponds to a CSS
|
||||
class for HTML output or Latex environment for Latex output where a
|
||||
leading @litchar{\} in the style name is treated specially (see
|
||||
@secref["extra-style"]).
|
||||
|
||||
}
|
||||
|
||||
@defstruct[delayed-block ([resolve (any/c part? resolve-info? . -> . block?)])]{
|
||||
|
||||
The @scheme[resolve] procedure is called during the @techlink{resolve
|
||||
pass} to obtain a normal @tech{block}. The first argument to
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
@defproc[(autobib-style-extras) list?]{
|
||||
|
||||
Include the content of the result list in the style of a document part
|
||||
Includes the content of the result list in the style of a document part
|
||||
that includes all figures. These style extras pull in HTML and Latex
|
||||
rendering support.}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user