From 1e81f0005af4d60bb1b56cc0b8813c5dc743805b Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 9 Oct 2017 08:34:23 -0700 Subject: [PATCH] scribble/decode: add 'no-index to avoid part titles in index Using 'no-index makes sense for a book, for example. --- scribble-doc/scribblings/scribble/core.scrbl | 10 +++++++++- scribble-doc/scribblings/scribble/decode.scrbl | 9 ++++++++- scribble-lib/info.rkt | 2 +- scribble-lib/scribble/decode.rkt | 5 +++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/scribble-doc/scribblings/scribble/core.scrbl b/scribble-doc/scribblings/scribble/core.scrbl index 7ddaa54f..307e5de7 100644 --- a/scribble-doc/scribblings/scribble/core.scrbl +++ b/scribble-doc/scribblings/scribble/core.scrbl @@ -451,6 +451,14 @@ The recognized @tech{style properties} are as follows: document, causes the HTML output to not include an ``on this page'' margin box.} + @item{@indexed-racket['no-index] --- Has no effect as a @tech{style + property} on a @racket[part], but as a style property on a + @racket[title] or @racket[part-start] that provides a + @racket[part]'s style via @racket[decode], the + @racket['no-index] @tech{style property} cause @racket[decode] + to skip the generation of an entry for the part's title in the + document index.} + @item{@racket[document-version] structure --- A version number for this part and its sub-parts (except as overridden). When it is not @racket[""] may be used when rendering a document; at a @@ -517,7 +525,7 @@ sub-parts). The @racket[parts] field contains sub-parts. -} +@history[#:changed "1.25" @elem{Added @racket['no-index] support.}]} @defstruct[paragraph ([style style?] [content content?])]{ diff --git a/scribble-doc/scribblings/scribble/decode.scrbl b/scribble-doc/scribblings/scribble/decode.scrbl index 3ce70c5a..3758ac13 100644 --- a/scribble-doc/scribblings/scribble/decode.scrbl +++ b/scribble-doc/scribblings/scribble/decode.scrbl @@ -94,8 +94,15 @@ parsing. Instances of @racket[section] trigger are used as-is as subsections, and instances of @racket[paragraph] and other flow-element datatypes are used as-is in the enclosing flow. +As a part is decoded, as long as the style for the part does not +include the @tech{style property} @racket['hidden] or +@racket['no-index], an entry is added to the document index for the +part's title. + Portions of @racket[lst] are within a part are decoded using -@racket[decode-flow].} +@racket[decode-flow]. + +@history[#:changed "1.25" @elem{Added @racket['no-index] support.}]} @defproc[(decode-part [lst (listof pre-part?)] diff --git a/scribble-lib/info.rkt b/scribble-lib/info.rkt index fd47dfe9..216eb7a7 100644 --- a/scribble-lib/info.rkt +++ b/scribble-lib/info.rkt @@ -23,4 +23,4 @@ (define pkg-authors '(mflatt eli)) -(define version "1.24") +(define version "1.25") diff --git a/scribble-lib/scribble/decode.rkt b/scribble-lib/scribble/decode.rkt index cf68d02c..966804a2 100644 --- a/scribble-lib/scribble/decode.rkt +++ b/scribble-lib/scribble/decode.rkt @@ -166,8 +166,9 @@ #f)) keys k-tags) colls)]) - (if (and title - (not (memq 'hidden (style-properties style)))) + (if (and title + (not (memq 'hidden (style-properties style))) + (not (memq 'no-index (style-properties style)))) (cons (make-index-element #f null (car tags) (list (clean-up-index-string