diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss index 542f095ec7..3349b37adf 100644 --- a/collects/scribble/html-render.ss +++ b/collects/scribble/html-render.ss @@ -572,6 +572,19 @@ (versioned-part-version d) (current-version))) + (define/public (extract-part-body-id d ri) + (or + (and (list? (part-style d)) + (ormap (lambda (s) + (and (list? s) + (= 2 (length s)) + (eq? (car s) 'body-id) + (string? (cadr s)) + (cadr s))) + (part-style d))) + (let ([p (part-parent d ri)]) + (and p (extract-part-body-id p ri))))) + (define/public (render-one-part d ri fn number) (parameterize ([current-output-file fn]) (let* ([prefix-file (or prefix-file scribble-prefix-html)] @@ -604,7 +617,8 @@ 'css (lambda (p) (part-whole-page? p ri))))) ,(scribble-js-contents script-file script-path)) - (body () + (body ((id ,(or (extract-part-body-id d ri) + "scribble-plt-scheme-org"))) ,@(render-toc-view d ri) (div ([class "maincolumn"]) (div ([class "main"]) diff --git a/collects/scribblings/scribble/struct.scrbl b/collects/scribblings/scribble/struct.scrbl index 31bf12b3a8..abdbfbd61d 100644 --- a/collects/scribblings/scribble/struct.scrbl +++ b/collects/scribblings/scribble/struct.scrbl @@ -294,6 +294,14 @@ values (must be in a list) are as follows: @item{@scheme[`(tex ,_path)] --- generated Latex includes (a copy of) @scheme[_path] in the document header.} + @item{@scheme[`(body-id ,_string)] --- generated HTML uses + @scheme[_string] as the @tt{id} attribute of the @tt{body} + tag; this style can be set separately for parts that start + different HTML pages, otherwise it is effectively inherited by + sub-parts; the default is @scheme["scribble-plt-scheme.org"], + but @exec{setup-plt} installs @scheme["doc-plt-scheme.org"] + as the @tt{id} for any document that it builds.} + } The @scheme[to-collect] field contains @techlink{content} that is diff --git a/collects/setup/scribble.ss b/collects/setup/scribble.ss index deb88f66f2..20caa3162f 100644 --- a/collects/setup/scribble.ss +++ b/collects/setup/scribble.ss @@ -310,12 +310,19 @@ (let ([tag-prefix p] [tags (if (member '(part "top") (part-tags v)) (part-tags v) - (cons '(part "top") (part-tags v)))]) + (cons '(part "top") (part-tags v)))] + [style (if (list? (part-style v)) + (part-style v) + (list (part-style v)))]) (make-versioned-part tag-prefix tags (part-title-content v) - (part-style v) + (if (ormap (lambda (s) + (and (pair? s) (eq? (car s) 'body-id))) + style) + style + (cons '(body-id "doc-plt-scheme-org") style)) (part-to-collect v) (part-flow v) (part-parts v)