add body id tag support to Scribble

svn: r13801
This commit is contained in:
Matthew Flatt 2009-02-23 12:48:30 +00:00
parent 6c0bcba374
commit ce79598a4a
3 changed files with 32 additions and 3 deletions

View File

@ -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"])

View File

@ -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

View File

@ -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)