Scribble: add 'grouper and 'hidden-number part style properties

Also, clean up documentation and implementation of 'unnumbered and
'hidden.

original commit: c0c2eda628c5786c18d29a3071087e268bd76109
This commit is contained in:
Matthew Flatt 2013-02-01 09:37:13 -08:00
parent 262f816a65
commit 1c5b304b1b
12 changed files with 447 additions and 115 deletions

View File

@ -39,7 +39,9 @@
render-nested-flow render-nested-flow
render-block render-block
render-other render-other
get-dest-directory)) get-dest-directory
format-number
number-depth))
(define render% (define render%
(class* object% (render<%>) (class* object% (render<%>)
@ -70,19 +72,46 @@
(define/public (format-number number sep) (define/public (format-number number sep)
(if (or (null? number) (if (or (null? number)
(andmap not number)) (andmap not number)
null (and (not (car number))
(cons (let ([s (apply (not (ormap number? number))))
string-append null
(map (lambda (n) (if n (format "~s." n) "")) (cons (let ([s (string-append
(reverse number)))]) (apply
(substring s 0 (sub1 (string-length s)))) string-append
sep))) (map (lambda (n) (if (number? n) (format "~a." n) ""))
(reverse (cdr number))))
(if (car number) (format "~a." (car number)) ""))])
(substring s 0 (sub1 (string-length s))))
sep)))
(define/public (number-depth number)
(if (null? number)
0
(+ 1 (for/sum ([i (in-list (cdr number))]) (if (not (string? i)) 1 0)))))
(field [report-output?? #f]) (field [report-output?? #f])
(define/public (report-output?) report-output??) (define/public (report-output?) report-output??)
(define/public (report-output!) (set! report-output?? #t)) (define/public (report-output!) (set! report-output?? #t))
;; should work up to 3999:
(define/private (number->roman n)
(let loop ([n n]
[I #\I] [V #\V]
[X #\X] [L #\L]
[C #\C] [D #\D]
[M #\M])
(case n
[(0) ""]
[(1 2 3) (make-string n I)]
[(4) (string I V)]
[(5) (string V)]
[(6 7 8) (string-append (string V) (make-string (- n 5) I))]
[(9) (string I X)]
[else
(string-append (loop (quotient n 10) X L C D M D M)
(loop (modulo n 10) I V X L C D M))])))
;; ---------------------------------------- ;; ----------------------------------------
(define/public (extract-part-style-files d ri tag stop-at-part? pred extract) (define/public (extract-part-style-files d ri tag stop-at-part? pred extract)
@ -447,10 +476,10 @@
ci)) ci))
(define/public (start-collect ds fns ci) (define/public (start-collect ds fns ci)
(map (lambda (d) (collect-part d #f ci null)) (map (lambda (d) (collect-part d #f ci null 1))
ds)) ds))
(define/public (collect-part d parent ci number) (define/public (collect-part d parent ci number init-sub-number)
(let ([p-ci (make-collect-info (let ([p-ci (make-collect-info
(collect-info-fp ci) (collect-info-fp ci)
(make-hash) (make-hash)
@ -469,33 +498,54 @@
(make-collected-info number (make-collected-info number
parent parent
(collect-info-ht p-ci))) (collect-info-ht p-ci)))
(parameterize ([current-tag-prefixes (define grouper? (and (pair? number) (part-style? d 'grouper)))
(extend-prefix d (fresh-tag-collect-context? d p-ci))]) (define next-sub-number
(when (part-title-content d) (parameterize ([current-tag-prefixes
(collect-content (part-title-content d) p-ci)) (extend-prefix d (fresh-tag-collect-context? d p-ci))])
(collect-part-tags d p-ci number) (when (part-title-content d)
(collect-content (part-to-collect d) p-ci) (collect-content (part-title-content d) p-ci))
(collect-flow (part-blocks d) p-ci) (collect-part-tags d p-ci number)
(let loop ([parts (part-parts d)] (collect-content (part-to-collect d) p-ci)
[pos 1]) (collect-flow (part-blocks d) p-ci)
(unless (null? parts) (let loop ([parts (part-parts d)]
(let ([s (car parts)]) [pos init-sub-number]
(collect-part s d p-ci [sub-pos 1])
(cons (if (part-style? s 'unnumbered) (if (null? parts)
#f pos
pos) (let ([s (car parts)])
number)) (define unnumbered? (part-style? s 'unnumbered))
(loop (cdr parts) (define hidden-number? (or unnumbered?
(if (part-style? s 'unnumbered) (part-style? s 'hidden-number)))
pos (define sub-grouper? (part-style? s 'grouper))
(add1 pos))))))) (define next-sub-pos
(collect-part s d p-ci
(cons (if hidden-number?
#f
(if sub-grouper?
(number->roman pos)
pos))
(if hidden-number?
(for/list ([i (in-list number)])
(if (string? i)
i
#f))
number))
sub-pos))
(loop (cdr parts)
(if unnumbered?
pos
(add1 pos))
(if sub-grouper?
next-sub-pos
1)))))))
(let ([prefix (part-tag-prefix d)]) (let ([prefix (part-tag-prefix d)])
(for ([(k v) (collect-info-ht p-ci)]) (for ([(k v) (collect-info-ht p-ci)])
(when (cadr k) (when (cadr k)
(collect-put! ci (if prefix (collect-put! ci (if prefix
(convert-key prefix k) (convert-key prefix k)
k) k)
v)))))) v))))
next-sub-number))
(define/private (convert-key prefix k) (define/private (convert-key prefix k)
(case (car k) (case (car k)
@ -950,7 +1000,11 @@
(convert-key prefix t)))))) (convert-key prefix t))))))
subs)]) subs)])
(if (and (= 1 (length number)) (if (and (= 1 (length number))
(or (not (car number)) ((car number) . > . 1))) (or (not (car number))
(and (number? (car number))
((car number) . > . 1))
(and (string? (car number))
(not (string=? (car number) "I")))))
(cons (list (make-paragraph (cons (list (make-paragraph
plain plain
(list (make-element 'hspace (list ""))))) (list (make-element 'hspace (list "")))))

View File

@ -207,7 +207,7 @@
[center-name string?] [center-name string?]
[bottom-name string?])] [bottom-name string?])]
[collected-info ([number (listof (or/c false/c integer?))] [collected-info ([number (listof (or/c false/c exact-nonnegative-integer? string?))]
[parent (or/c false/c part?)] [parent (or/c false/c part?)]
[info any/c])]) [info any/c])])

View File

@ -220,6 +220,7 @@
install-file install-file
get-dest-directory get-dest-directory
format-number format-number
number-depth
quiet-table-of-contents quiet-table-of-contents
extract-part-style-files extract-part-style-files
extract-version extract-version
@ -280,7 +281,7 @@
(map (lambda (d fn) (map (lambda (d fn)
(parameterize ([current-output-file fn] (parameterize ([current-output-file fn]
[current-top-part d]) [current-top-part d])
(collect-part d #f ci null))) (collect-part d #f ci null 1)))
ds ds
fns)) fns))
@ -916,7 +917,7 @@
(add-current-tag-prefix (add-current-tag-prefix
(tag-key t ri)))))))) (tag-key t ri))))))))
(part-tags d))] (part-tags d))]
[else `((,(case (length number) [else `((,(case (number-depth number)
[(0) 'h2] [(0) 'h2]
[(1) 'h3] [(1) 'h3]
[(2) 'h4] [(2) 'h4]
@ -1542,7 +1543,7 @@
orig-s)) orig-s))
(hash-set! (current-part-files) s #t))) (hash-set! (current-part-files) s #t)))
(define/override (collect-part d parent ci number) (define/override (collect-part d parent ci number sub-init-number)
(let ([prev-sub (collecting-sub)]) (let ([prev-sub (collecting-sub)])
(parameterize ([collecting-sub (if (part-style? d 'toc) (parameterize ([collecting-sub (if (part-style? d 'toc)
1 1
@ -1555,8 +1556,8 @@
filename)]) filename)])
(check-duplicate-filename full-filename) (check-duplicate-filename full-filename)
(parameterize ([current-output-file full-filename]) (parameterize ([current-output-file full-filename])
(super collect-part d parent ci number))) (super collect-part d parent ci number sub-init-number)))
(super collect-part d parent ci number))))) (super collect-part d parent ci number sub-init-number)))))
(define/override (render ds fns ri) (define/override (render ds fns ri)
(map (lambda (d fn) (map (lambda (d fn)

View File

@ -56,6 +56,7 @@
render-part render-part
install-file install-file
format-number format-number
number-depth
extract-part-style-files extract-part-style-files
extract-version extract-version
extract-date extract-date
@ -148,32 +149,62 @@
(for ([pre (in-list pres)]) (for ([pre (in-list pres)])
(printf "\n\n") (printf "\n\n")
(do-render-paragraph pre d ri #t #f))) (do-render-paragraph pre d ri #t #f)))
(define depth (+ (number-depth number) (or (render-part-depth) 0)))
(define grouper? (part-style? d 'grouper))
(define (inc-section-number)
(printf "\\Sinc~a" (case depth
[(0 1) (if grouper? "part" "section")]
[(2) "subsection"]
[(3) "subsubsection"]
[(4) "subsubsubsection"]
[else "subsubsubsubsection"])))
(cond (cond
[completely-hidden? [completely-hidden?
(printf "\n\n\\notitlesection")] (printf "\n\n\\notitlesection")
(unless (part-style? d 'unnumbered)
(inc-section-number))]
[else [else
(let ([no-number? (and (pair? number) (define no-number? (and (pair? number)
(or (not (car number)) (or (not (car number))
((length number) . > . 3)))]) ((length number) . > . 3))))
(printf "\n\n\\~a~a~a" (define no-toc? (part-style? d 'toc-hidden))
(case (+ (length number) (or (render-part-depth) 0)) (define (show-number)
[(0 1) "sectionNewpage\n\n\\Ssection"] (when (and (part-style? d 'grouper)
[(2) "Ssubsection"] (depth . > . 1)
[(3) "Ssubsubsection"] (not no-number?))
[(4) "Ssubsubsubsection"] (printf "~a\\quad{}" (car (format-number number null)))))
[else "Ssubsubsubsubsection"]) (printf "\n\n\\~a~a~a"
(if (and (part-style? d 'hidden) (not no-number?)) (case depth
"hidden" "") [(0 1) (if grouper?
(if no-number? "star" "")) "partNewpage\n\n\\Spart"
(when (not (or (part-style? d 'hidden) no-number?)) "sectionNewpage\n\n\\Ssection")]
(printf "{") [(2) "Ssubsection"]
(parameterize ([disable-images #t] [(3) "Ssubsubsection"]
[escape-brackets #t]) [(4) "Ssubsubsubsection"]
(render-content (part-title-content d) d ri)) [else "Ssubsubsubsubsection"])
(printf "}"))) (if (and grouper?
(depth . > . 1))
"grouper"
"")
(if no-number?
(if no-toc?
"star"
"starx")
""))
(unless (and no-number? no-toc?)
(printf "{")
(show-number)
(parameterize ([disable-images #t]
[escape-brackets #t])
(render-content (part-title-content d) d ri))
(printf "}"))
(printf "{") (printf "{")
(show-number)
(render-content (part-title-content d) d ri) (render-content (part-title-content d) d ri)
(printf "}") (printf "}")
(when (and (part-style? d 'hidden-number)
(not (part-style? d 'unnumbered)))
(inc-section-number))
(when (eq? (style-name (part-style d)) 'index) (printf "\n\n"))])) (when (eq? (style-name (part-style d)) 'index) (printf "\n\n"))]))
(for ([t (part-tags d)]) (for ([t (part-tags d)])
(printf "\\label{t:~a}~a" (t-encode (add-current-tag-prefix (tag-key t ri))) (printf "\\label{t:~a}~a" (t-encode (add-current-tag-prefix (tag-key t ri)))

View File

@ -1,5 +1,7 @@
#lang racket/base #lang racket/base
(require "core.rkt" "base-render.rkt" (require "core.rkt"
"base-render.rkt"
"private/render-utils.rkt"
racket/class racket/port racket/list racket/string racket/match racket/class racket/port racket/list racket/string racket/match
scribble/text/wrap) scribble/text/wrap)
(provide render-mixin) (provide render-mixin)
@ -35,20 +37,28 @@
(#rx"''" "\U201D") (#rx"''" "\U201D")
(#rx"'" "\U2019"))) (#rx"'" "\U2019")))
(inherit render-block) (inherit render-block
format-number
number-depth)
(define/override (render-part d ht) (define/override (render-part d ht)
(let ([number (collected-info-number (part-collected-info d ht))]) (let ([number (collected-info-number (part-collected-info d ht))])
(unless (zero? (length number)) (unless (part-style? d 'hidden)
(printf (make-string (length number) #\#)) (unless (zero? (number-depth number))
(printf " ")) (printf (make-string (number-depth number) #\#))
(for ([n (in-list (reverse number))] #:when n) (printf "~s." n)) (printf " "))
(when (part-title-content d) (let ([s (format-number number '())])
(when (ormap values number) (printf " ")) (unless (null? s)
(render-content (part-title-content d) d ht)) (printf "~a.~a"
(when (or (ormap values number) (part-title-content d)) (car s)
(newline) (if (part-title-content d)
(newline)) " "
"")))
(when (part-title-content d)
(render-content (part-title-content d) d ht))
(when (or (pair? number) (part-title-content d))
(newline)
(newline))))
(render-flow (part-blocks d) d ht #f) (render-flow (part-blocks d) d ht #f)
(let loop ([pos 1] (let loop ([pos 1]
[secs (part-parts d)] [secs (part-parts d)]

View File

@ -19,6 +19,8 @@
% Inserted before every ``chapter'', useful for starting each one on a new page: % Inserted before every ``chapter'', useful for starting each one on a new page:
\newcommand{\sectionNewpage}{} \newcommand{\sectionNewpage}{}
% Inserted before every book ``part''
\newcommand{\partNewpage}{\sectionNewpage}
% Hooks for actions within the `document' environment: % Hooks for actions within the `document' environment:
\newcommand{\preDoc}{} \newcommand{\preDoc}{}
@ -153,36 +155,57 @@
\newcommand{\SNumberOfAuthors}[1]{} \newcommand{\SNumberOfAuthors}[1]{}
% sections % sections
\newcommand{\Spart}[2]{\part[#1]{#2}}
\newcommand{\Ssection}[2]{\section[#1]{#2}} \newcommand{\Ssection}[2]{\section[#1]{#2}}
\newcommand{\Ssubsection}[2]{\subsection[#1]{#2}} \newcommand{\Ssubsection}[2]{\subsection[#1]{#2}}
\newcommand{\Ssubsubsection}[2]{\subsubsection[#1]{#2}} \newcommand{\Ssubsubsection}[2]{\subsubsection[#1]{#2}}
\newcommand{\Ssubsubsubsection}[2]{{\bf #2}} \newcommand{\Ssubsubsubsection}[2]{{\bf #2}}
\newcommand{\Ssubsubsubsubsection}[2]{\Ssubsubsubsection{#1}{#2}} \newcommand{\Ssubsubsubsubsection}[2]{\Ssubsubsubsection{#1}{#2}}
% "star" means unnumbered and not in ToC:
\newcommand{\Spartstar}[1]{\part*{#1}}
\newcommand{\Ssectionstar}[1]{\section*{#1}} \newcommand{\Ssectionstar}[1]{\section*{#1}}
\newcommand{\Ssubsectionstar}[1]{\subsection*{#1}} \newcommand{\Ssubsectionstar}[1]{\subsection*{#1}}
\newcommand{\Ssubsubsectionstar}[1]{\subsubsection*{#1}} \newcommand{\Ssubsubsectionstar}[1]{\subsubsection*{#1}}
\newcommand{\Ssubsubsubsectionstar}[1]{{\bf #1}} \newcommand{\Ssubsubsubsectionstar}[1]{{\bf #1}}
\newcommand{\Ssubsubsubsubsectionstar}[1]{\Ssubsubsubsectionstar{#1}} \newcommand{\Ssubsubsubsubsectionstar}[1]{\Ssubsubsubsectionstar{#1}}
\newcommand{\Ssectionhidden}[1]{\sectionhidden{#1}} % "starx" means unnumbered but in ToC:
\newcommand{\Ssubsectionhidden}[1]{\subsectionhidden{#1}} \newcommand{\Spartstarx}[2]{\Spartstar{#2}\addcontentsline{toc}{part}{#1}}
\newcommand{\Ssubsubsectionhidden}[1]{\subsubsectionhidden{#1}} \newcommand{\Ssectionstarx}[2]{\Ssectionstar{#2}\addcontentsline{toc}{section}{#1}}
\newcommand{\Ssubsubsubsectionhidden}[1]{\subsubsubsectionhidden{#1}} \newcommand{\Ssubsectionstarx}[2]{\Ssubsectionstar{#2}\addcontentsline{toc}{subsection}{#1}}
\newcommand{\Ssubsubsubsubsectionhidden}[1]{\Ssubsubsubsectionhidden{#1}} \newcommand{\Ssubsubsectionstarx}[2]{\Ssubsubsectionstar{#2}\addcontentsline{toc}{subsubsection}{#1}}
\newcommand{\Ssubsubsubsectionstarx}[2]{\Ssubsubsubsectionstar{#2}}
\newcommand{\Ssubsubsubsubsectionstarx}[2]{\Ssubsubsubsubsectionstar{#2}}
% Used for parts with the 'hidden style variant: % "grouper" is for the 'grouper style variant --- on subsections and lower,
\newcommand{\sectionhidden}[1]{\Ssection{#1}{#1}} % because \Spart is used for grouper at the section level. Grouper implies
\newcommand{\subsectionhidden}[1]{\Ssubsection{#1}{#1}} % unnumbered.
\newcommand{\subsubsectionhidden}[1]{\Ssubsubsection{#1}{#1}} \newcounter{GrouperTemp}
\newcommand{\subsubsubsectionhidden}[1]{\Ssubsubsubsection{#1}{#1}} \newcommand{\Ssubsectiongrouper}[2]{\setcounter{GrouperTemp}{\value{subsection}}\Ssubsectionstarx{#1}{#2}\setcounter{subsection}{\value{GrouperTemp}}}
\newcommand{\Ssubsubsectiongrouper}[2]{\setcounter{GrouperTemp}{\value{subsubsection}}\Ssubsubsectionstarx{#1}{#2}\setcounter{subsubsection}{\value{GrouperTemp}}}
\newcommand{\Ssubsubsubsectiongrouper}[2]{\Ssubsubsubsectionstarx{#1}{#2}}
\newcommand{\Ssubsubsubsubsectiongrouper}[2]{\Ssubsubsubsubsectionstarx{#1}{#2}}
\newcommand{\Ssubsectiongrouperstar}[1]{\setcounter{GrouperTemp}{\value{subsection}}\Ssubsectionstar{#1}\setcounter{subsection}{\value{GrouperTemp}}}
\newcommand{\Ssubsubsectiongrouperstar}[1]{\setcounter{GrouperTemp}{\value{subsubsection}}\Ssubsubsectionstar{#1}\setcounter{subsubsection}{\value{GrouperTemp}}}
\newcommand{\Ssubsubsubsectiongrouperstar}[1]{\Ssubsubsubsectionstar{#1}}
\newcommand{\Ssubsubsubsubsectiongrouperstar}[1]{\Ssubsubsubsubsectionstar{#1}}
% Generated by `subsubsub*section': % Generated by `subsubsub*section':
\newcommand{\SSubSubSubSection}[1]{\Ssubsubsubsubsectionhidden{#1}} \newcommand{\SSubSubSubSection}[1]{\Ssubsubsubsubsectionstar{#1}}
% For hidden parts with an empty title: % For hidden parts with an empty title:
\newcommand{\notitlesection}{\vspace{2ex}\phantomsection\noindent} \newcommand{\notitlesection}{\vspace{2ex}\phantomsection\noindent}
% To increments section numbers:
\newcommand{\Sincpart}{\stepcounter{part}}
\newcommand{\Sincsection}{\stepcounter{section}}
\newcommand{\Sincsubsection}{\stepcounter{subsection}}
\newcommand{\Sincsubsubsection}{\stepcounter{subsubsection}}
\newcommand{\Sincsubsubsubsection}{}
\newcommand{\Sincsubsubsubsubsection}{}
% When brackets appear in section titles: % When brackets appear in section titles:
\newcommand{\SOpenSq}{[} \newcommand{\SOpenSq}{[}
\newcommand{\SCloseSq}{]} \newcommand{\SCloseSq}{]}

View File

@ -1,5 +1,7 @@
#lang racket/base #lang racket/base
(require "core.rkt" "base-render.rkt" (require "core.rkt"
"base-render.rkt"
"private/render-utils.rkt"
racket/class racket/port racket/list racket/string racket/class racket/port racket/list racket/string
scribble/text/wrap) scribble/text/wrap)
(provide render-mixin) (provide render-mixin)
@ -29,17 +31,24 @@
(#rx"''" "\U201D") (#rx"''" "\U201D")
(#rx"'" "\U2019"))) (#rx"'" "\U2019")))
(inherit render-block) (inherit render-block
format-number)
(define/override (render-part d ht) (define/override (render-part d ht)
(let ([number (collected-info-number (part-collected-info d ht))]) (let ([number (collected-info-number (part-collected-info d ht))])
(for ([n (in-list (reverse number))] #:when n) (printf "~s." n)) (unless (part-style? d 'hidden)
(when (part-title-content d) (let ([s (format-number number '())])
(when (ormap values number) (printf " ")) (unless (null? s)
(render-content (part-title-content d) d ht)) (printf "~a.~a"
(when (or (ormap values number) (part-title-content d)) (car s)
(newline) (if (part-title-content d)
(newline)) " "
"")))
(when (part-title-content d)
(render-content (part-title-content d) d ht))
(when (or (pair? number) (part-title-content d))
(newline)
(newline))))
(render-flow (part-blocks d) d ht #f) (render-flow (part-blocks d) d ht #f)
(let loop ([pos 1] (let loop ([pos 1]
[secs (part-parts d)] [secs (part-parts d)]

View File

@ -332,9 +332,9 @@ searching for information in each enclosing part before sibling parts.
@section{Structure Reference} @section{Structure Reference}
@defstruct[part ([tag-prefix (or/c false/c string?)] @defstruct[part ([tag-prefix (or/c #f string?)]
[tags (listof tag?)] [tags (listof tag?)]
[title-content (or/c false/c list?)] [title-content (or/c #f list?)]
[style style?] [style style?]
[to-collect list?] [to-collect list?]
[blocks (listof block?)] [blocks (listof block?)]
@ -362,9 +362,28 @@ The recognized @tech{style properties} are as follows:
@itemize[ @itemize[
@item{@racket['unnumbered] --- A section number is computed for an @item{@racket['unnumbered] --- A section number is not computed or
unnumbered section during the @techlink{collect pass}, but the rendered for the section.}
number is not rendered.}
@item{@racket['hidden-number] --- A section number is computed for
the section, but it is not rendered as part of the section name.}
@item{@racket['toc-hidden] --- The part title is not shown in tables
of contents, including in ``on this page'' boxes. For Latex
rendering, the part title is omitted only if it is unnumbered
or has a hidden number.}
@item{@racket['hidden] --- The part title is not shown; for Latex
output, the part title is not shown only if its is empty, and
in that case, it is also excluded from tables of contents. The
@racket['toc-hidden] style usually should be included with
@racket['hidden] (for consistency in non-Latex output).}
@item{@racket['grouper] --- The part is numbered with a Roman
numeral, and its subsections continue numbering as if they
appeared in the preceeding part. In other works, the part acts
like a ``part'' in a book where chapter numbering is continuous
across parts.}
@item{@racket['toc] --- Sub-parts of the part are rendered on separate @item{@racket['toc] --- Sub-parts of the part are rendered on separate
pages for multi-page HTML mode.} pages for multi-page HTML mode.}
@ -377,14 +396,6 @@ The recognized @tech{style properties} are as follows:
displayed in a table-of-contents panel in HTML output (which displayed in a table-of-contents panel in HTML output (which
normally shows only the top-level sections).} normally shows only the top-level sections).}
@item{@racket['hidden] --- The part title is not shown in rendered
HTML output, and the part title is not shown in Latex output if it
is empty. The @racket['toc-hidden] style usually should be
included with @racket['hidden].}
@item{@racket['toc-hidden] --- The part title is not shown in tables
of contents, including in ``on this page'' boxes.}
@item{@racket['quiet] --- In HTML output and most other output modes, @item{@racket['quiet] --- In HTML output and most other output modes,
hides entries for sub-parts of this part in a hides entries for sub-parts of this part in a
@racket[table-of-contents] or @racket[local-table-of-contents] @racket[table-of-contents] or @racket[local-table-of-contents]
@ -509,7 +520,7 @@ The currently recognized @tech{style properties} are as follows:
@defstruct[table ([style style?] @defstruct[table ([style style?]
[blockss (listof (listof (or/c block? (one-of/c 'cont))))])]{ [blockss (listof (listof (or/c block? 'cont)))])]{
See also the @racket[tabular] function. See also the @racket[tabular] function.
@ -997,11 +1008,17 @@ If a @racket[render-element] instance is serialized (such as when
saving collected info), it is reduced to a @racket[element] instance.} saving collected info), it is reduced to a @racket[element] instance.}
@defstruct[collected-info ([number (listof (or/c false/c integer?))] @defstruct[collected-info ([number (listof (or/c #f exact-nonnegative-integer? string?))]
[parent (or/c false/c part?)] [parent (or/c #f part?)]
[info any/c])]{ [info any/c])]{
Computed for each part by the @techlink{collect pass}.} Computed for each part by the @techlink{collect pass}.
The length of the @racket[number] list indicates the section's nesting
depth. Numbers in @racket[number] correspond to the section's number,
it's parent's number, etc. A string is used for a @racket['grouping]
section, and @racket[#f] is used in place of all numbers for an
unnumbered section.}
@defstruct[target-url ([addr path-string?])]{ @defstruct[target-url ([addr path-string?])]{
@ -1011,13 +1028,13 @@ allowed for @racket[addr], but a string is interpreted as a URL rather
than a file path.} than a file path.}
@defstruct[document-version ([text (or/c string? false/c)])]{ @defstruct[document-version ([text (or/c string? #f)])]{
Used as a @tech{style property} for a @racket[part] to indicate a Used as a @tech{style property} for a @racket[part] to indicate a
version number.} version number.}
@defstruct[document-date ([text (or/c string? false/c)])]{ @defstruct[document-date ([text (or/c string? #f)])]{
Used as a @tech{style property} for a @racket[part] to indicate a Used as a @tech{style property} for a @racket[part] to indicate a
date (which is typically used for Latex output).} date (which is typically used for Latex output).}
@ -1251,7 +1268,7 @@ only during the @techlink{collect pass}.
} }
@defproc[(resolve-get [p (or/c part? false/c)] [ri resolve-info?] [key info-key?]) @defproc[(resolve-get [p (or/c part? #f)] [ri resolve-info?] [key info-key?])
any/c]{ any/c]{
Extract information during the @techlink{resolve pass} or Extract information during the @techlink{resolve pass} or
@ -1267,7 +1284,7 @@ documentation.
} }
@defproc[(resolve-get/ext? [p (or/c part? false/c)] [ri resolve-info?] [key info-key?]) @defproc[(resolve-get/ext? [p (or/c part? #f)] [ri resolve-info?] [key info-key?])
(values any/c boolean?)]{ (values any/c boolean?)]{
Like @racket[render-get], but returns a second value to indicate Like @racket[render-get], but returns a second value to indicate
@ -1275,7 +1292,7 @@ whether the resulting information originated from an external source
(i.e., a different document).} (i.e., a different document).}
@defproc[(resolve-search [dep-key any/c] [p (or/c part? false/c)] [ri resolve-info?] [key info-key?]) @defproc[(resolve-search [dep-key any/c] [p (or/c part? #f)] [ri resolve-info?] [key info-key?])
void?]{ void?]{
Like @racket[resolve-get], but a shared @racket[dep-key] groups Like @racket[resolve-get], but a shared @racket[dep-key] groups
@ -1289,7 +1306,7 @@ mean that an earlier attempt would succeed next time).
} }
@defproc[(resolve-get/tentative [p (or/c part? false/c)] [ri resolve-info?] [key info-key?]) @defproc[(resolve-get/tentative [p (or/c part? #f)] [ri resolve-info?] [key info-key?])
any/c]{ any/c]{
Like @racket[resolve-search], but without dependency tracking. For Like @racket[resolve-search], but without dependency tracking. For
@ -1299,7 +1316,7 @@ is suitable for use only for information within a single document.
} }
@defproc[(resolve-get-keys [p (or/c part? false/c)] @defproc[(resolve-get-keys [p (or/c part? #f)]
[ri resolve-info?] [ri resolve-info?]
[pred (info-key? . -> . any/c)]) [pred (info-key? . -> . any/c)])
list?]{ list?]{

View File

@ -0,0 +1,41 @@
#lang scribble/manual
@title{Hello}
@table-of-contents[]
@section{One}
@subsection{A Section}
@subsubsection{A Subsection}
This is some prose.
@subsubsection{A Subsection, Revisited}
This is also some prose.
@section{Two}
@subsection[#:style 'grouper]{Another Section}
@subsubsection{Another Subsection}
More prose.
@subsubsection{Another Subsection, Revisited}
More prose, also.
@subsection[#:style 'grouper]{Third Section}
@subsubsection{Yet Another Subsection}
Yet more prose.
@subsubsection{Yet Another Subsection, Revisited}
Yet more prose, also.

View File

@ -0,0 +1,48 @@
Hello
    1 One
      1.1 A Section
        1.1.1 A Subsection
        1.1.2 A Subsection, Revisited
    2 Two
      2.I Another Section
        2.1 Another Subsection
        2.2 Another Subsection, Revisited
      2.II Third Section
        2.3 Yet Another Subsection
        2.4 Yet Another Subsection, Revisited
1. One
1.1. A Section
1.1.1. A Subsection
This is some prose.
1.1.2. A Subsection, Revisited
This is also some prose.
2. Two
2.I. Another Section
2.1. Another Subsection
More prose.
2.2. Another Subsection, Revisited
More prose, also.
2.II. Third Section
2.3. Yet Another Subsection
Yet more prose.
2.4. Yet Another Subsection, Revisited
Yet more prose, also.

View File

@ -0,0 +1,46 @@
#lang scribble/manual
@title{Hello}
@table-of-contents[]
@section[#:style 'grouper]{One}
@subsection{A Section}
@subsubsection{A Subsection}
This is some prose.
@subsubsection{A Subsection, Revisited}
This is also some prose.
@section[#:style 'grouper]{Two}
@subsection{Another Section}
@subsubsection{Another Subsection}
More prose.
@subsubsection[#:style 'unnumbered]{>> Unnumbered Subsection}
Nothing to see here.
@subsubsection{Another Subsection, Revisited}
More prose, also.
@subsubsection[#:style 'hidden-number]{>> Hidden Number}
Nothing to see here, either.
@subsubsection{Last Subsection}
The last subsection has some prose.
@subsection[#:style '(hidden toc-hidden)]{}
This is actually in a hidden section.

View File

@ -0,0 +1,52 @@
Hello
    I One
      1 A Section
        1.1 A Subsection
        1.2 A Subsection, Revisited
    II Two
      2 Another Section
        2.1 Another Subsection
        >> Unnumbered Subsection
        2.2 Another Subsection, Revisited
        >> Hidden Number
        2.4 Last Subsection
I. One
1. A Section
1.1. A Subsection
This is some prose.
1.2. A Subsection, Revisited
This is also some prose.
II. Two
2. Another Section
2.1. Another Subsection
More prose.
>> Unnumbered Subsection
Nothing to see here.
2.2. Another Subsection, Revisited
More prose, also.
>> Hidden Number
Nothing to see here, either.
2.4. Last Subsection
The last subsection has some prose.
This is actually in a hidden section.