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:
parent
262f816a65
commit
1c5b304b1b
|
@ -39,7 +39,9 @@
|
|||
render-nested-flow
|
||||
render-block
|
||||
render-other
|
||||
get-dest-directory))
|
||||
get-dest-directory
|
||||
format-number
|
||||
number-depth))
|
||||
|
||||
(define render%
|
||||
(class* object% (render<%>)
|
||||
|
@ -70,19 +72,46 @@
|
|||
|
||||
(define/public (format-number number sep)
|
||||
(if (or (null? number)
|
||||
(andmap not number))
|
||||
null
|
||||
(cons (let ([s (apply
|
||||
string-append
|
||||
(map (lambda (n) (if n (format "~s." n) ""))
|
||||
(reverse number)))])
|
||||
(substring s 0 (sub1 (string-length s))))
|
||||
sep)))
|
||||
(andmap not number)
|
||||
(and (not (car number))
|
||||
(not (ormap number? number))))
|
||||
null
|
||||
(cons (let ([s (string-append
|
||||
(apply
|
||||
string-append
|
||||
(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])
|
||||
(define/public (report-output?) report-output??)
|
||||
(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)
|
||||
|
@ -447,10 +476,10 @@
|
|||
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))
|
||||
|
||||
(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
|
||||
(collect-info-fp ci)
|
||||
(make-hash)
|
||||
|
@ -469,33 +498,54 @@
|
|||
(make-collected-info number
|
||||
parent
|
||||
(collect-info-ht p-ci)))
|
||||
(parameterize ([current-tag-prefixes
|
||||
(extend-prefix d (fresh-tag-collect-context? d p-ci))])
|
||||
(when (part-title-content d)
|
||||
(collect-content (part-title-content d) p-ci))
|
||||
(collect-part-tags d p-ci number)
|
||||
(collect-content (part-to-collect d) p-ci)
|
||||
(collect-flow (part-blocks d) p-ci)
|
||||
(let loop ([parts (part-parts d)]
|
||||
[pos 1])
|
||||
(unless (null? parts)
|
||||
(let ([s (car parts)])
|
||||
(collect-part s d p-ci
|
||||
(cons (if (part-style? s 'unnumbered)
|
||||
#f
|
||||
pos)
|
||||
number))
|
||||
(loop (cdr parts)
|
||||
(if (part-style? s 'unnumbered)
|
||||
pos
|
||||
(add1 pos)))))))
|
||||
(define grouper? (and (pair? number) (part-style? d 'grouper)))
|
||||
(define next-sub-number
|
||||
(parameterize ([current-tag-prefixes
|
||||
(extend-prefix d (fresh-tag-collect-context? d p-ci))])
|
||||
(when (part-title-content d)
|
||||
(collect-content (part-title-content d) p-ci))
|
||||
(collect-part-tags d p-ci number)
|
||||
(collect-content (part-to-collect d) p-ci)
|
||||
(collect-flow (part-blocks d) p-ci)
|
||||
(let loop ([parts (part-parts d)]
|
||||
[pos init-sub-number]
|
||||
[sub-pos 1])
|
||||
(if (null? parts)
|
||||
pos
|
||||
(let ([s (car parts)])
|
||||
(define unnumbered? (part-style? s 'unnumbered))
|
||||
(define hidden-number? (or unnumbered?
|
||||
(part-style? s 'hidden-number)))
|
||||
(define sub-grouper? (part-style? s 'grouper))
|
||||
(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)])
|
||||
(for ([(k v) (collect-info-ht p-ci)])
|
||||
(when (cadr k)
|
||||
(collect-put! ci (if prefix
|
||||
(convert-key prefix k)
|
||||
k)
|
||||
v))))))
|
||||
v))))
|
||||
next-sub-number))
|
||||
|
||||
(define/private (convert-key prefix k)
|
||||
(case (car k)
|
||||
|
@ -950,7 +1000,11 @@
|
|||
(convert-key prefix t))))))
|
||||
subs)])
|
||||
(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
|
||||
plain
|
||||
(list (make-element 'hspace (list "")))))
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
[center-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?)]
|
||||
[info any/c])])
|
||||
|
||||
|
|
|
@ -220,6 +220,7 @@
|
|||
install-file
|
||||
get-dest-directory
|
||||
format-number
|
||||
number-depth
|
||||
quiet-table-of-contents
|
||||
extract-part-style-files
|
||||
extract-version
|
||||
|
@ -280,7 +281,7 @@
|
|||
(map (lambda (d fn)
|
||||
(parameterize ([current-output-file fn]
|
||||
[current-top-part d])
|
||||
(collect-part d #f ci null)))
|
||||
(collect-part d #f ci null 1)))
|
||||
ds
|
||||
fns))
|
||||
|
||||
|
@ -916,7 +917,7 @@
|
|||
(add-current-tag-prefix
|
||||
(tag-key t ri))))))))
|
||||
(part-tags d))]
|
||||
[else `((,(case (length number)
|
||||
[else `((,(case (number-depth number)
|
||||
[(0) 'h2]
|
||||
[(1) 'h3]
|
||||
[(2) 'h4]
|
||||
|
@ -1542,7 +1543,7 @@
|
|||
orig-s))
|
||||
(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)])
|
||||
(parameterize ([collecting-sub (if (part-style? d 'toc)
|
||||
1
|
||||
|
@ -1555,8 +1556,8 @@
|
|||
filename)])
|
||||
(check-duplicate-filename full-filename)
|
||||
(parameterize ([current-output-file full-filename])
|
||||
(super collect-part d parent ci number)))
|
||||
(super collect-part d parent ci number)))))
|
||||
(super collect-part d parent ci number sub-init-number)))
|
||||
(super collect-part d parent ci number sub-init-number)))))
|
||||
|
||||
(define/override (render ds fns ri)
|
||||
(map (lambda (d fn)
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
render-part
|
||||
install-file
|
||||
format-number
|
||||
number-depth
|
||||
extract-part-style-files
|
||||
extract-version
|
||||
extract-date
|
||||
|
@ -148,32 +149,62 @@
|
|||
(for ([pre (in-list pres)])
|
||||
(printf "\n\n")
|
||||
(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
|
||||
[completely-hidden?
|
||||
(printf "\n\n\\notitlesection")]
|
||||
(printf "\n\n\\notitlesection")
|
||||
(unless (part-style? d 'unnumbered)
|
||||
(inc-section-number))]
|
||||
[else
|
||||
(let ([no-number? (and (pair? number)
|
||||
(or (not (car number))
|
||||
((length number) . > . 3)))])
|
||||
(printf "\n\n\\~a~a~a"
|
||||
(case (+ (length number) (or (render-part-depth) 0))
|
||||
[(0 1) "sectionNewpage\n\n\\Ssection"]
|
||||
[(2) "Ssubsection"]
|
||||
[(3) "Ssubsubsection"]
|
||||
[(4) "Ssubsubsubsection"]
|
||||
[else "Ssubsubsubsubsection"])
|
||||
(if (and (part-style? d 'hidden) (not no-number?))
|
||||
"hidden" "")
|
||||
(if no-number? "star" ""))
|
||||
(when (not (or (part-style? d 'hidden) no-number?))
|
||||
(printf "{")
|
||||
(parameterize ([disable-images #t]
|
||||
[escape-brackets #t])
|
||||
(render-content (part-title-content d) d ri))
|
||||
(printf "}")))
|
||||
(define no-number? (and (pair? number)
|
||||
(or (not (car number))
|
||||
((length number) . > . 3))))
|
||||
(define no-toc? (part-style? d 'toc-hidden))
|
||||
(define (show-number)
|
||||
(when (and (part-style? d 'grouper)
|
||||
(depth . > . 1)
|
||||
(not no-number?))
|
||||
(printf "~a\\quad{}" (car (format-number number null)))))
|
||||
(printf "\n\n\\~a~a~a"
|
||||
(case depth
|
||||
[(0 1) (if grouper?
|
||||
"partNewpage\n\n\\Spart"
|
||||
"sectionNewpage\n\n\\Ssection")]
|
||||
[(2) "Ssubsection"]
|
||||
[(3) "Ssubsubsection"]
|
||||
[(4) "Ssubsubsubsection"]
|
||||
[else "Ssubsubsubsubsection"])
|
||||
(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 "{")
|
||||
(show-number)
|
||||
(render-content (part-title-content d) d ri)
|
||||
(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"))]))
|
||||
(for ([t (part-tags d)])
|
||||
(printf "\\label{t:~a}~a" (t-encode (add-current-tag-prefix (tag-key t ri)))
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#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
|
||||
scribble/text/wrap)
|
||||
(provide render-mixin)
|
||||
|
@ -35,20 +37,28 @@
|
|||
(#rx"''" "\U201D")
|
||||
(#rx"'" "\U2019")))
|
||||
|
||||
(inherit render-block)
|
||||
(inherit render-block
|
||||
format-number
|
||||
number-depth)
|
||||
|
||||
(define/override (render-part d ht)
|
||||
(let ([number (collected-info-number (part-collected-info d ht))])
|
||||
(unless (zero? (length number))
|
||||
(printf (make-string (length number) #\#))
|
||||
(printf " "))
|
||||
(for ([n (in-list (reverse number))] #:when n) (printf "~s." n))
|
||||
(when (part-title-content d)
|
||||
(when (ormap values number) (printf " "))
|
||||
(render-content (part-title-content d) d ht))
|
||||
(when (or (ormap values number) (part-title-content d))
|
||||
(newline)
|
||||
(newline))
|
||||
(unless (part-style? d 'hidden)
|
||||
(unless (zero? (number-depth number))
|
||||
(printf (make-string (number-depth number) #\#))
|
||||
(printf " "))
|
||||
(let ([s (format-number number '())])
|
||||
(unless (null? s)
|
||||
(printf "~a.~a"
|
||||
(car s)
|
||||
(if (part-title-content d)
|
||||
" "
|
||||
"")))
|
||||
(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)
|
||||
(let loop ([pos 1]
|
||||
[secs (part-parts d)]
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
% Inserted before every ``chapter'', useful for starting each one on a new page:
|
||||
\newcommand{\sectionNewpage}{}
|
||||
% Inserted before every book ``part''
|
||||
\newcommand{\partNewpage}{\sectionNewpage}
|
||||
|
||||
% Hooks for actions within the `document' environment:
|
||||
\newcommand{\preDoc}{}
|
||||
|
@ -153,36 +155,57 @@
|
|||
\newcommand{\SNumberOfAuthors}[1]{}
|
||||
|
||||
% sections
|
||||
\newcommand{\Spart}[2]{\part[#1]{#2}}
|
||||
\newcommand{\Ssection}[2]{\section[#1]{#2}}
|
||||
\newcommand{\Ssubsection}[2]{\subsection[#1]{#2}}
|
||||
\newcommand{\Ssubsubsection}[2]{\subsubsection[#1]{#2}}
|
||||
\newcommand{\Ssubsubsubsection}[2]{{\bf #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{\Ssubsectionstar}[1]{\subsection*{#1}}
|
||||
\newcommand{\Ssubsubsectionstar}[1]{\subsubsection*{#1}}
|
||||
\newcommand{\Ssubsubsubsectionstar}[1]{{\bf #1}}
|
||||
\newcommand{\Ssubsubsubsubsectionstar}[1]{\Ssubsubsubsectionstar{#1}}
|
||||
|
||||
\newcommand{\Ssectionhidden}[1]{\sectionhidden{#1}}
|
||||
\newcommand{\Ssubsectionhidden}[1]{\subsectionhidden{#1}}
|
||||
\newcommand{\Ssubsubsectionhidden}[1]{\subsubsectionhidden{#1}}
|
||||
\newcommand{\Ssubsubsubsectionhidden}[1]{\subsubsubsectionhidden{#1}}
|
||||
\newcommand{\Ssubsubsubsubsectionhidden}[1]{\Ssubsubsubsectionhidden{#1}}
|
||||
% "starx" means unnumbered but in ToC:
|
||||
\newcommand{\Spartstarx}[2]{\Spartstar{#2}\addcontentsline{toc}{part}{#1}}
|
||||
\newcommand{\Ssectionstarx}[2]{\Ssectionstar{#2}\addcontentsline{toc}{section}{#1}}
|
||||
\newcommand{\Ssubsectionstarx}[2]{\Ssubsectionstar{#2}\addcontentsline{toc}{subsection}{#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:
|
||||
\newcommand{\sectionhidden}[1]{\Ssection{#1}{#1}}
|
||||
\newcommand{\subsectionhidden}[1]{\Ssubsection{#1}{#1}}
|
||||
\newcommand{\subsubsectionhidden}[1]{\Ssubsubsection{#1}{#1}}
|
||||
\newcommand{\subsubsubsectionhidden}[1]{\Ssubsubsubsection{#1}{#1}}
|
||||
% "grouper" is for the 'grouper style variant --- on subsections and lower,
|
||||
% because \Spart is used for grouper at the section level. Grouper implies
|
||||
% unnumbered.
|
||||
\newcounter{GrouperTemp}
|
||||
\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':
|
||||
\newcommand{\SSubSubSubSection}[1]{\Ssubsubsubsubsectionhidden{#1}}
|
||||
\newcommand{\SSubSubSubSection}[1]{\Ssubsubsubsubsectionstar{#1}}
|
||||
|
||||
% For hidden parts with an empty title:
|
||||
\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:
|
||||
\newcommand{\SOpenSq}{[}
|
||||
\newcommand{\SCloseSq}{]}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#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
|
||||
scribble/text/wrap)
|
||||
(provide render-mixin)
|
||||
|
@ -29,17 +31,24 @@
|
|||
(#rx"''" "\U201D")
|
||||
(#rx"'" "\U2019")))
|
||||
|
||||
(inherit render-block)
|
||||
(inherit render-block
|
||||
format-number)
|
||||
|
||||
(define/override (render-part d ht)
|
||||
(let ([number (collected-info-number (part-collected-info d ht))])
|
||||
(for ([n (in-list (reverse number))] #:when n) (printf "~s." n))
|
||||
(when (part-title-content d)
|
||||
(when (ormap values number) (printf " "))
|
||||
(render-content (part-title-content d) d ht))
|
||||
(when (or (ormap values number) (part-title-content d))
|
||||
(newline)
|
||||
(newline))
|
||||
(unless (part-style? d 'hidden)
|
||||
(let ([s (format-number number '())])
|
||||
(unless (null? s)
|
||||
(printf "~a.~a"
|
||||
(car s)
|
||||
(if (part-title-content d)
|
||||
" "
|
||||
"")))
|
||||
(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)
|
||||
(let loop ([pos 1]
|
||||
[secs (part-parts d)]
|
||||
|
|
|
@ -332,9 +332,9 @@ searching for information in each enclosing part before sibling parts.
|
|||
|
||||
@section{Structure Reference}
|
||||
|
||||
@defstruct[part ([tag-prefix (or/c false/c string?)]
|
||||
@defstruct[part ([tag-prefix (or/c #f string?)]
|
||||
[tags (listof tag?)]
|
||||
[title-content (or/c false/c list?)]
|
||||
[title-content (or/c #f list?)]
|
||||
[style style?]
|
||||
[to-collect list?]
|
||||
[blocks (listof block?)]
|
||||
|
@ -362,9 +362,28 @@ The recognized @tech{style properties} are as follows:
|
|||
|
||||
@itemize[
|
||||
|
||||
@item{@racket['unnumbered] --- A section number is computed for an
|
||||
unnumbered section during the @techlink{collect pass}, but the
|
||||
number is not rendered.}
|
||||
@item{@racket['unnumbered] --- A section number is not computed or
|
||||
rendered for the section.}
|
||||
|
||||
@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
|
||||
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
|
||||
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,
|
||||
hides entries for sub-parts of this part in a
|
||||
@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?]
|
||||
[blockss (listof (listof (or/c block? (one-of/c 'cont))))])]{
|
||||
[blockss (listof (listof (or/c block? 'cont)))])]{
|
||||
|
||||
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.}
|
||||
|
||||
|
||||
@defstruct[collected-info ([number (listof (or/c false/c integer?))]
|
||||
[parent (or/c false/c part?)]
|
||||
@defstruct[collected-info ([number (listof (or/c #f exact-nonnegative-integer? string?))]
|
||||
[parent (or/c #f part?)]
|
||||
[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?])]{
|
||||
|
@ -1011,13 +1028,13 @@ allowed for @racket[addr], but a string is interpreted as a URL rather
|
|||
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
|
||||
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
|
||||
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]{
|
||||
|
||||
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?)]{
|
||||
|
||||
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).}
|
||||
|
||||
|
||||
@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?]{
|
||||
|
||||
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]{
|
||||
|
||||
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?]
|
||||
[pred (info-key? . -> . any/c)])
|
||||
list?]{
|
||||
|
|
41
collects/tests/scribble/docs/grouper-sub.scrbl
Normal file
41
collects/tests/scribble/docs/grouper-sub.scrbl
Normal 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.
|
||||
|
48
collects/tests/scribble/docs/grouper-sub.txt
Normal file
48
collects/tests/scribble/docs/grouper-sub.txt
Normal 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.
|
46
collects/tests/scribble/docs/grouper.scrbl
Normal file
46
collects/tests/scribble/docs/grouper.scrbl
Normal 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.
|
52
collects/tests/scribble/docs/grouper.txt
Normal file
52
collects/tests/scribble/docs/grouper.txt
Normal 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.
|
Loading…
Reference in New Issue
Block a user