Support custom categories on root documentation page
When custom categories are used in older versions, raco setup will report a warning, but the documentation will still appear under the Miscellaneous section. Thus, this is a backwards compatible implementation of the idea.
This commit is contained in:
parent
93d286914e
commit
2e34599ce3
|
@ -452,9 +452,13 @@ Optional @filepath{info.rkt} fields trigger additional actions by
|
|||
]
|
||||
|
||||
The @racket[_category] list specifies how to show the document in
|
||||
the root table of contents. The list must start with a symbol,
|
||||
usually one of the following categories, which are ordered as
|
||||
below in the root documentation page:
|
||||
the root table of contents. The list must start with a category,
|
||||
which determines where the manual appears in the root
|
||||
documentation page. A category is either a string or a symbol. If
|
||||
it is a string, then the string is the category label on the root
|
||||
page. If it is a symbol, then it a default category label is
|
||||
used. The available symbols and the order of categories on the
|
||||
root documentation page is as below:
|
||||
|
||||
@itemize[
|
||||
|
||||
|
@ -483,6 +487,8 @@ Optional @filepath{info.rkt} fields trigger additional actions by
|
|||
@item{@racket['interop] : Documentation for interoperability
|
||||
tools and libraries.}
|
||||
|
||||
@item{All string categories as ordered by @racket[string<=?].}
|
||||
|
||||
@item{@racket['library] : Documentation for libraries; this
|
||||
category is the default and used for unrecognized category
|
||||
symbols.}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
(truncate (/ (caar l) 10))))])
|
||||
(if sep? (cons (mk-sep lbl) l) l))]))))
|
||||
|
||||
(define (get-docs all? tag)
|
||||
(define (get-docs all? tag #:custom-secs [custom-secs (make-hash)])
|
||||
(let* ([recs (find-relevant-directory-records (list tag) (if all? 'all-available 'no-user))]
|
||||
[infos (map get-info/full (map directory-record-path recs))]
|
||||
[docs (append-map
|
||||
|
@ -55,7 +55,10 @@
|
|||
;; Category
|
||||
(let ([the-cat
|
||||
(if (pair? new-cat) (car new-cat) 'unknown)])
|
||||
(or (and (or (eq? the-cat 'omit)
|
||||
(or (and (string? the-cat)
|
||||
(let ([the-cat-sym (gensym)])
|
||||
(hash-ref! custom-secs the-cat the-cat-sym)))
|
||||
(and (or (eq? the-cat 'omit)
|
||||
(eq? the-cat 'omit-start))
|
||||
the-cat)
|
||||
(ormap (lambda (sec)
|
||||
|
@ -90,7 +93,18 @@
|
|||
(cdr l)))
|
||||
|
||||
(define (make-start-page all?)
|
||||
(let* ([docs (get-docs all? 'scribblings)]
|
||||
(let* ([custom-secs (make-hash)]
|
||||
[docs (get-docs all? 'scribblings
|
||||
#:custom-secs custom-secs)]
|
||||
[sections+custom
|
||||
(append-map (λ (sec)
|
||||
(if (eq? 'library (sec-cat sec))
|
||||
(append (for/list ([label (sort (hash-keys custom-secs)
|
||||
string<=?)])
|
||||
(make-sec (hash-ref custom-secs label) label))
|
||||
(list sec))
|
||||
(list sec)))
|
||||
sections)]
|
||||
[plain-line
|
||||
(lambda content
|
||||
(list (make-flow (list (make-paragraph content)))))]
|
||||
|
@ -151,5 +165,5 @@
|
|||
renderer part resolve-info))])
|
||||
(string-ci<? (str ad) (str bd)))
|
||||
(> (car ad) (car bd)))))))])))
|
||||
sections))))
|
||||
sections+custom))))
|
||||
(make-delayed-block contents)))
|
||||
|
|
|
@ -162,7 +162,8 @@
|
|||
(or (not name) (collection-name-element? name))
|
||||
(and (list? cat)
|
||||
(<= 1 (length cat) 2)
|
||||
(symbol? (car cat))
|
||||
(or (symbol? (car cat))
|
||||
(string? (car cat)))
|
||||
(or (null? (cdr cat))
|
||||
(real? (cadr cat))))
|
||||
(and (exact-positive-integer? out-count))
|
||||
|
|
Loading…
Reference in New Issue
Block a user