scribblings config: 'keep-style and 'no-search flag, 'omit-start section

The 'keep-style avoids imposing the Racket manual style on a
document, while 'no-search omits the search box. The 'omit-start
section is like 'omit, but the document is still indexed and
available for cross-references.

Also, recognize a 'prefixable tag shape so that the set of tags
hat support prefixing is extensible.
This commit is contained in:
Matthew Flatt 2014-01-08 07:30:59 -07:00
parent 86df55a877
commit c4f4ba4ca3
5 changed files with 60 additions and 23 deletions

View File

@ -379,6 +379,12 @@ Optional @filepath{info.rkt} fields trigger additional actions by
that currently has this mode should be the only one with that currently has this mode should be the only one with
the mode.} the mode.}
@item{@racket['keep-style] : Leave the document's style as-is,
instead of imposing the document style for manuals.}
@item{@racket['no-search] : Build the document without a search
box.}
] ]
The @racket[_category] list specifies how to show the document in The @racket[_category] list specifies how to show the document in
@ -425,7 +431,11 @@ Optional @filepath{info.rkt} fields trigger additional actions by
@item{@racket['other] : Other documentation.} @item{@racket['other] : Other documentation.}
@item{@racket['omit] : Documentation that should not be listed on @item{@racket['omit] : Documentation that should not be listed on
the root page.} the root page or indexed for searching.}
@item{@racket['omit-start] : Documentation that should not be
listed on the root page but should be indexed for
searching.}
] ]

View File

@ -55,7 +55,9 @@
;; Category ;; Category
(let ([the-cat (let ([the-cat
(if (pair? new-cat) (car new-cat) 'unknown)]) (if (pair? new-cat) (car new-cat) 'unknown)])
(or (and (eq? the-cat 'omit) the-cat) (or (and (or (eq? the-cat 'omit)
(eq? the-cat 'omit-start))
the-cat)
(ormap (lambda (sec) (ormap (lambda (sec)
(and (eq? the-cat (sec-cat sec)) (and (eq? the-cat (sec-cat sec))
the-cat)) the-cat))

View File

@ -147,7 +147,7 @@
(define (scribblings-flag? sym) (define (scribblings-flag? sym)
(memq sym '(main-doc main-doc-root user-doc-root user-doc multi-page (memq sym '(main-doc main-doc-root user-doc-root user-doc multi-page
depends-all depends-all-main depends-all-user depends-all depends-all-main depends-all-user
no-depend-on always-run))) no-depend-on always-run keep-style no-search)))
(define (validate-scribblings-infos infos) (define (validate-scribblings-infos infos)
(define (validate path [flags '()] [cat '(library)] [name #f] [out-count 1] [order-hint 0]) (define (validate path [flags '()] [cat '(library)] [name #f] [out-count 1] [order-hint 0])
(and (string? path) (relative-path? path) (and (string? path) (relative-path? path)
@ -768,8 +768,12 @@
((if multi? html:render-multi-mixin values) ((if multi? html:render-multi-mixin values)
(html:render-mixin render%))) (html:render-mixin render%)))
;; Use PLT manual style: ;; Use PLT manual style:
[style-file (collection-file-path "manual-style.css" "scribble")] [style-file (if (memq 'keep-style flags)
[extra-files (list (collection-file-path "manual-fonts.css" "scribble"))] #f
(collection-file-path "manual-style.css" "scribble"))]
[extra-files (if (memq 'keep-style flags)
null
(list (collection-file-path "manual-fonts.css" "scribble")))]
;; See also `style-extra-files`, below ;; See also `style-extra-files`, below
[dest-dir (if multi? [dest-dir (if multi?
(let-values ([(base name dir?) (split-path ddir)]) base) (let-values ([(base name dir?) (split-path ddir)]) base)
@ -810,13 +814,15 @@
;; be moved into a binary package: ;; be moved into a binary package:
[root-path (and allow-indirect? ddir)] [root-path (and allow-indirect? ddir)]
[style-extra-files (cons [style-extra-files (if (memq 'keep-style flags)
(collection-file-path "manual-racket.css" "scribble") null
(map (lambda (s) (cons
(collection-file-path s "scribble")) (collection-file-path "manual-racket.css" "scribble")
shared-empty-style-files))] (map (lambda (s)
(collection-file-path s "scribble"))
shared-empty-style-files)))]
[search-box? #t])) [search-box? (not (memq 'no-search flags))]))
(for ([s (in-list shared-empty-script-files)]) (for ([s (in-list shared-empty-script-files)])
(send r add-extra-script-file (collection-file-path s "scribble"))) (send r add-extra-script-file (collection-file-path s "scribble")))
(when allow-indirect? (when allow-indirect?

View File

@ -243,17 +243,32 @@ of the second half of the tag.
A part can have a @deftech{tag prefix}, which is effectively added A part can have a @deftech{tag prefix}, which is effectively added
onto the second item within each tag whose first item is onto the second item within each tag whose first item is
@racket['part] or @racket['tech]. The prefix is added to a string @racket['part], @racket['tech], or @racket['cite], or whose second
value by creating a list containing the prefix and string, and it is item is a list that starts with @racket['prefixable]:
added to a list value using @racket[cons]; a prefix is not added to a
@racket[generated-tag] instance. The prefix is used for reference @itemlist[
outside the part, including the use of tags in the part's
@racket[tags] field. Typically, a document's main part has a tag @item{The prefix is added to a string second item by creating a list
prefix that applies to the whole document; references to sections and containing the prefix and string.}
defined terms within the document from other documents must include the prefix,
while references within the same document omit the prefix. Part @item{The prefix is added to a list second item after @racket['part],
prefixes can be used within a document as well, to help disambiguate @racket['tech], or @racket['cite] using @racket[cons].}
references within the document.
@item{The prefix is added to a second item that starts
@racket['prefixable] by adding it to the list after
@racket['prefixable].}
@item{A prefix is not added to a @racket[generated-tag] item.}
]
The prefix is used for reference outside the part, including the use
of tags in the part's @racket[tags] field. Typically, a document's
main part has a tag prefix that applies to the whole document;
references to sections and defined terms within the document from
other documents must include the prefix, while references within the
same document omit the prefix. Part prefixes can be used within a
document as well, to help disambiguate references within the document.
Some procedures accept a ``tag'' that is just the string part of the Some procedures accept a ``tag'' that is just the string part of the
full tag, where the symbol part is supplied automatically. For full tag, where the symbol part is supplied automatically. For

View File

@ -583,7 +583,11 @@
[(index-entry) [(index-entry)
(let ([v (convert-key prefix (cadr k))]) (let ([v (convert-key prefix (cadr k))])
(if (eq? v (cadr k)) k (list 'index-entry v)))] (if (eq? v (cadr k)) k (list 'index-entry v)))]
[else k])) [else
(if (and (pair? (cadr k))
(eq? 'prefixable (caadr k)))
(list (car k) (list* 'prefixable prefix (cdadr k)))
k)]))
(define/public (collect-part-tags d ci number) (define/public (collect-part-tags d ci number)
(for ([t (part-tags d)]) (for ([t (part-tags d)])