From 4a512f6a66cfda5f65dc233d509c0a8273d77e73 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 11 Sep 2012 17:39:12 -0600 Subject: [PATCH] racket/html-properties: add `js-addition' original commit: 9162fc25042364c128be0b850c730a93ff910679 --- collects/scribble/html-properties.rkt | 1 + collects/scribble/html-render.rkt | 13 +++++++++++++ collects/scribblings/scribble/core.scrbl | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/collects/scribble/html-properties.rkt b/collects/scribble/html-properties.rkt index 7d384f0e..4c95fd08 100644 --- a/collects/scribble/html-properties.rkt +++ b/collects/scribble/html-properties.rkt @@ -9,6 +9,7 @@ [script-property ([type string?] [script (or/c path-string? (listof string?))])] [css-addition ([path (or/c path-string? (cons/c 'collects (listof bytes?)) bytes?)])] + [js-addition ([path (or/c path-string? (cons/c 'collects (listof bytes?)) bytes?)])] [html-defaults ([prefix-path (or/c bytes? path-string? (cons/c 'collects (listof bytes?)))] [style-path (or/c bytes? path-string? (cons/c 'collects (listof bytes?)))] [extra-files (listof (or/c path-string? (cons/c 'collects (listof bytes?))))])] diff --git a/collects/scribble/html-render.rkt b/collects/scribble/html-render.rkt index a64d1a3e..58464095 100644 --- a/collects/scribble/html-render.rkt +++ b/collects/scribble/html-render.rkt @@ -686,6 +686,19 @@ (list style-file) style-extra-files)) ,(scribble-js-contents script-file (lookup-path script-file alt-paths)) + ,@(map (lambda (script-file) + (if (bytes? script-file) + (scribble-js-contents script-file #f) + (let ([p (lookup-path script-file alt-paths)]) + (unless p (install-file script-file)) + (scribble-js-contents script-file p)))) + (extract-part-style-files + d + ri + 'css + (lambda (p) (part-whole-page? p ri)) + js-addition? + js-addition-path)) ,(xml:comment "[if IE 6]>main-collects-relative].} +@defstruct[js-addition ([path (or/c path-string? + (cons/c 'collects (listof bytes?)) + bytes?)])]{ + +Like @racket[css-addition], but for a Javascript file instead of a CSS file.} + + @defstruct[body-id ([value string?])]{ Used as a @tech{style property} to associate an @tt{id} attribute with