commit 6ea98dd621997d079a7bd15c118732648bef8053
parent 8089d6867beb1bd93a60d581000d2d09eaef8beb
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Mon, 23 Feb 2009 12:48:30 +0000
add body id tag support to Scribble
svn: r13801
original commit: ce79598a4a896d2f7b3c0ade5ed344b5b9691546
Diffstat:
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git 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
@@ -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