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 @racket[_category] list specifies how to show the document in
|
||||||
the root table of contents. The list must start with a symbol,
|
the root table of contents. The list must start with a category,
|
||||||
usually one of the following categories, which are ordered as
|
which determines where the manual appears in the root
|
||||||
below in the root documentation page:
|
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[
|
@itemize[
|
||||||
|
|
||||||
|
@ -483,6 +487,8 @@ Optional @filepath{info.rkt} fields trigger additional actions by
|
||||||
@item{@racket['interop] : Documentation for interoperability
|
@item{@racket['interop] : Documentation for interoperability
|
||||||
tools and libraries.}
|
tools and libraries.}
|
||||||
|
|
||||||
|
@item{All string categories as ordered by @racket[string<=?].}
|
||||||
|
|
||||||
@item{@racket['library] : Documentation for libraries; this
|
@item{@racket['library] : Documentation for libraries; this
|
||||||
category is the default and used for unrecognized category
|
category is the default and used for unrecognized category
|
||||||
symbols.}
|
symbols.}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
(truncate (/ (caar l) 10))))])
|
(truncate (/ (caar l) 10))))])
|
||||||
(if sep? (cons (mk-sep lbl) l) l))]))))
|
(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))]
|
(let* ([recs (find-relevant-directory-records (list tag) (if all? 'all-available 'no-user))]
|
||||||
[infos (map get-info/full (map directory-record-path recs))]
|
[infos (map get-info/full (map directory-record-path recs))]
|
||||||
[docs (append-map
|
[docs (append-map
|
||||||
|
@ -55,7 +55,10 @@
|
||||||
;; 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 (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))
|
(eq? the-cat 'omit-start))
|
||||||
the-cat)
|
the-cat)
|
||||||
(ormap (lambda (sec)
|
(ormap (lambda (sec)
|
||||||
|
@ -90,7 +93,18 @@
|
||||||
(cdr l)))
|
(cdr l)))
|
||||||
|
|
||||||
(define (make-start-page all?)
|
(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
|
[plain-line
|
||||||
(lambda content
|
(lambda content
|
||||||
(list (make-flow (list (make-paragraph content)))))]
|
(list (make-flow (list (make-paragraph content)))))]
|
||||||
|
@ -151,5 +165,5 @@
|
||||||
renderer part resolve-info))])
|
renderer part resolve-info))])
|
||||||
(string-ci<? (str ad) (str bd)))
|
(string-ci<? (str ad) (str bd)))
|
||||||
(> (car ad) (car bd)))))))])))
|
(> (car ad) (car bd)))))))])))
|
||||||
sections))))
|
sections+custom))))
|
||||||
(make-delayed-block contents)))
|
(make-delayed-block contents)))
|
||||||
|
|
|
@ -162,7 +162,8 @@
|
||||||
(or (not name) (collection-name-element? name))
|
(or (not name) (collection-name-element? name))
|
||||||
(and (list? cat)
|
(and (list? cat)
|
||||||
(<= 1 (length cat) 2)
|
(<= 1 (length cat) 2)
|
||||||
(symbol? (car cat))
|
(or (symbol? (car cat))
|
||||||
|
(string? (car cat)))
|
||||||
(or (null? (cdr cat))
|
(or (null? (cdr cat))
|
||||||
(real? (cadr cat))))
|
(real? (cadr cat))))
|
||||||
(and (exact-positive-integer? out-count))
|
(and (exact-positive-integer? out-count))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user