bkyk8rc3zvpnsf5inmcqq4n3k98cv6hj-my-site-hyper-literate-git.test.suzanne.soy-0.0.1

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit f470e3c3a7add3aba0afea621c859a5573a8ec40
parent 92b715cb96c90adaf0c10cf32b7cf9aa77c1eba0
Author: Matthew Flatt <mflatt@racket-lang.org>
Date:   Tue, 11 Sep 2012 17:18:14 -0600

scribble HTML: add `head-extra' and support for `attributes'

For a part that corresponds to an HTML page.

original commit: dc925d2d8cb4802281981cd3a271c07f74234c4d

Diffstat:
Mcollects/scribble/html-properties.rkt | 7+++++--
Mcollects/scribble/html-render.rkt | 7+++++--
Mcollects/scribblings/scribble/core.scrbl | 18++++++++++++++++--
3 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/collects/scribble/html-properties.rkt b/collects/scribble/html-properties.rkt @@ -1,6 +1,7 @@ #lang scheme/base (require "private/provide-structs.rkt" - racket/contract/base) + racket/contract/base + xml/xexpr) (provide-structs [body-id ([value string?])] @@ -15,4 +16,6 @@ [url-anchor ([name string?])] [alt-tag ([name (and/c string? #rx"^[a-zA-Z0-9]+$")])] [attributes ([assoc (listof (cons/c symbol? string?))])] - [column-attributes ([assoc (listof (cons/c symbol? string?))])]) + [column-attributes ([assoc (listof (cons/c symbol? string?))])] + + [head-extra ([xexpr xexpr/c])]) diff --git a/collects/scribble/html-render.rkt b/collects/scribble/html-render.rkt @@ -664,7 +664,7 @@ (copy-port in (current-output-port))))) (parameterize ([xml:empty-tag-shorthand xml:html-empty-tags]) (xml:write-xexpr - `(html () + `(html ,(style->attribs (part-style d)) (head () (meta ([http-equiv "content-type"] [content "text-html; charset=utf-8"])) @@ -686,7 +686,10 @@ (list style-file) style-extra-files)) ,(scribble-js-contents script-file (lookup-path script-file alt-paths)) - ,(xml:comment "[if IE 6]><style type=\"text/css\">.SIEHidden { overflow: hidden; }</style><![endif]")) + ,(xml:comment "[if IE 6]><style type=\"text/css\">.SIEHidden { overflow: hidden; }</style><![endif]") + ,@(for/list ([p (style-properties (part-style d))] + #:when (head-extra? p)) + (head-extra-xexpr p))) (body ([id ,(or (extract-part-body-id d ri) "scribble-racket-lang-org")]) ,@(render-toc-view d ri) diff --git a/collects/scribblings/scribble/core.scrbl b/collects/scribblings/scribble/core.scrbl @@ -4,7 +4,8 @@ (for-label scribble/manual-struct file/convertible setup/main-collects - scriblib/render-cond)) + scriblib/render-cond + xml/xexpr)) @title[#:tag "core"]{Structures And Processing} @@ -407,13 +408,21 @@ The recognized @tech{style properties} are as follows: @racket[""] to suppress a date in an output document.} @item{@racket[body-id] structure --- Generated HTML uses the given - string @tt{id} attribute of the @tt{body} tag; this style can + string @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 @racket["scribble-racket-lang.org"], but @exec{setup-plt} installs @racket["doc-racket-lang.org"] as the @tt{id} for any document that it builds.} + @item{@racket[attributes] structure --- Provides additional HTML + attributes for the @tt{<html>} tag when the part corresponds to + its own HTML page.} + + @item{@racket[head-extra] structure --- Provides additional HTML + content for the @tt{<head>} tag when the part corresponds to + its own HTML page.} + ] The @racket[to-collect] field contains @techlink{content} that is @@ -1414,6 +1423,11 @@ Like @racket[latex-defaults], but use for the @DFlag{htmls} modes.} +@defstruct[head-extra ([xexpr xexpr/c])]{ + +For a @racket[part] that corresponds to an HTML page, adds content to +the @tt{<head>} tag.} + @; ---------------------------------------- @section{Latex Style Properties}