From f470e3c3a7add3aba0afea621c859a5573a8ec40 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 11 Sep 2012 17:18:14 -0600 Subject: [PATCH] scribble HTML: add `head-extra' and support for `attributes' For a part that corresponds to an HTML page. original commit: dc925d2d8cb4802281981cd3a271c07f74234c4d --- collects/scribble/html-properties.rkt | 7 +++++-- collects/scribble/html-render.rkt | 7 +++++-- collects/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 index 0644a511..7d384f0e 100644 --- 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 index 4905d6e4..a64d1a3e 100644 --- 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]>} 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{} tag when the part corresponds to + its own HTML page.} + + @item{@racket[head-extra] structure --- Provides additional HTML + content for the @tt{} 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{} tag.} + @; ---------------------------------------- @section{Latex Style Properties}