diff --git a/collects/scribble/base-render.ss b/collects/scribble/base-render.ss index 0cebeeb1d9..b49b784714 100644 --- a/collects/scribble/base-render.ss +++ b/collects/scribble/base-render.ss @@ -74,7 +74,7 @@ (for/list ([k (in-hash-keys ht)]) (main-collects-relative->path k)))) (define/private (extract-style-style-files s ht pred extract) - (for ([v (in-list (style-variants s))]) + (for ([v (in-list (style-properties s))]) (when (pred v) (hash-set! ht (extract v) #t)))) @@ -132,7 +132,7 @@ (or (ormap (lambda (v) (and (document-version? v) (document-version-text v))) - (style-variants (part-style d))) + (style-properties (part-style d))) "")) (define/private (extract-pre-paras d sym) @@ -464,7 +464,7 @@ (unless prefix-file (for ([d (in-list ds)]) (let ([extras (ormap (lambda (v) (and (auto-extra-files? v) v)) - (style-variants (part-style d)))]) + (style-properties (part-style d)))]) (when extras (for ([fn (in-list (auto-extra-files-paths extras))]) (install-file (main-collects-relative->path fn)))))))) @@ -531,7 +531,7 @@ (define/public (render-block p part ri starting-item?) (cond - [(table? p) (if (memq 'aux (style-variants (table-style p))) + [(table? p) (if (memq 'aux (style-properties (table-style p))) (render-auxiliary-table p part ri) (render-table p part ri starting-item?))] [(itemization? p) (render-itemization p part ri)] diff --git a/collects/scribble/base.ss b/collects/scribble/base.ss index c9f71fbc6b..c6a4f2292d 100644 --- a/collects/scribble/base.ss +++ b/collects/scribble/base.ss @@ -4,7 +4,7 @@ "core.ss" "manual-struct.ss" "decode-struct.ss" - "html-variants.ss" + "html-properties.ss" scheme/list scheme/class scheme/contract @@ -501,7 +501,7 @@ style) (cons (make-target-url url) (if (style? style) - (style-variants style) + (style-properties style) null))) (decode-content str))) diff --git a/collects/scribble/core.ss b/collects/scribble/core.ss index eb1caa8e0f..4483c888a9 100644 --- a/collects/scribble/core.ss +++ b/collects/scribble/core.ss @@ -169,12 +169,12 @@ [contents (listof content?)])] [style ([name (or/c string? symbol? #f)] - [variants list?])] - ;; variants: + [properties list?])] + ;; properties: [document-version ([text (or/c string? false/c)])] [target-url ([addr path-string?])] - [color-variant ([color (or/c string? (list/c byte? byte? byte?))])] - [background-color-variant ([color (or/c string? (list/c byte? byte? byte?))])] + [color-property ([color (or/c string? (list/c byte? byte? byte?))])] + [background-color-property ([color (or/c string? (list/c byte? byte? byte?))])] [table-columns ([styles (listof style?)])] [table-cells ([styless (listof (listof style?))])] @@ -455,7 +455,7 @@ (and (element? e) (let ([s (element-style e)]) (and (style? e) - (memq 'aux (style-variants s)))))) + (memq 'aux (style-properties s)))))) (define (strip-aux content) (cond diff --git a/collects/scribble/decode.ss b/collects/scribble/decode.ss index 567abd3177..588344352f 100644 --- a/collects/scribble/decode.ss +++ b/collects/scribble/decode.ss @@ -6,19 +6,6 @@ scheme/class scheme/list) -(provide decode - decode-part - decode-flow - decode-paragraph - decode-compound-paragraph - decode-content - (rename-out [decode-content decode-elements]) - decode-string - whitespace? - clean-up-index-string - pre-content? - pre-flow?) - (define (pre-content? i) (or (string? i) (and (content? i) @@ -34,6 +21,17 @@ (and (splice? i) (andmap pre-flow? (splice-run i))))) +(define (pre-part? v) + (or (pre-flow? v) + (title-decl? v) + (part-start? v) + (part-index-decl? v) + (part-collect-decl? v) + (part-tag-decl? v) + (part? v) + (and (splice? v) + (andmap pre-part? (splice-run v))))) + (provide-structs [title-decl ([tag-prefix (or/c false/c string?)] [tags (listof tag?)] @@ -51,6 +49,33 @@ [part-collect-decl ([element (or/c element? part-relative-element?)])] [part-tag-decl ([tag tag?])]) +(provide whitespace? + pre-content? + pre-flow? + pre-part?) + +(provide/contract + [decode (-> (listof pre-part?) + part?)] + [decode-part (-> (listof pre-part?) + (listof string?) + (or/c #f content?) + exact-nonnegative-integer? + part?)] + [decode-flow (-> (listof pre-flow?) + (listof block?))] + [decode-paragraph (-> (listof pre-content?) + paragraph?)] + [decode-compound-paragraph (-> (listof pre-flow?) + paragraph?)] + [decode-content (-> (listof pre-content?) + content?)] + [rename decode-content decode-elements + (-> (listof pre-content?) + content?)] + [decode-string (-> string? content?)] + [clean-up-index-string (-> string? string?)]) + (define (clean-up-index-string s) ;; Collapse whitespace, and remove leading or trailing spaces, which ;; might appear there due to images or something else that gets @@ -102,7 +127,7 @@ (if vers (make-style (style-name style) (cons (make-document-version vers) - (style-variants style))) + (style-properties style))) style) (let ([l (append (map (lambda (k tag) @@ -113,7 +138,7 @@ keys k-tags) colls)]) (if (and title - (not (memq 'hidden (style-variants style)))) + (not (memq 'hidden (style-properties style)))) (cons (make-index-element #f null (car tags) (list (clean-up-index-string diff --git a/collects/scribble/html-variants.ss b/collects/scribble/html-properties.ss similarity index 81% rename from collects/scribble/html-variants.ss rename to collects/scribble/html-properties.ss index 405b4fdbb3..dc26d85178 100644 --- a/collects/scribble/html-variants.ss +++ b/collects/scribble/html-properties.ss @@ -4,9 +4,9 @@ (provide-structs [body-id ([value string?])] - [hover-variant ([text string?])] - [script-variant ([type string?] - [script (or/c path-string? (listof string?))])] + [hover-property ([text string?])] + [script-property ([type string?] + [script (or/c path-string? (listof string?))])] [css-addition ([path (or/c path-string? (cons/c 'collects (listof 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?)))] diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss index a6a7beb9ed..5243a86d83 100644 --- a/collects/scribble/html-render.ss +++ b/collects/scribble/html-render.ss @@ -2,7 +2,7 @@ (require "core.ss" "private/render-utils.ss" - "html-variants.ss" + "html-properties.ss" scheme/class scheme/path scheme/file @@ -132,14 +132,14 @@ (cond [(attributes? v) (map (lambda (v) (list (car v) (cdr v))) (attributes-assoc v))] - [(color-variant? v) - `((style ,(format "color: ~a" (color->string (color-variant-color v)))))] - [(background-color-variant? v) - `((style ,(format "background-color: ~a" (color->string (background-color-variant-color v)))))] - [(hover-variant? v) - `((title ,(hover-variant-text v)))] + [(color-property? v) + `((style ,(format "color: ~a" (color->string (color-property-color v)))))] + [(background-color-property? v) + `((style ,(format "background-color: ~a" (color->string (background-color-property-color v)))))] + [(hover-property? v) + `((title ,(hover-property-text v)))] [else null])) - (style-variants style)))]) + (style-properties style)))]) (let ([name (style-name style)]) (if (string? name) (cons `[class ,name] @@ -432,7 +432,7 @@ (filter (lambda (e) (let loop ([e e]) (or (and (table? e) - (memq 'aux (style-variants (table-style e))) + (memq 'aux (style-properties (table-style e))) (pair? (table-blockss e))) (and (delayed-block? e) (loop (delayed-block-blocks e ri)))))) @@ -539,14 +539,14 @@ (or (ormap (lambda (v) (and (body-id? v) (body-id-value v))) - (style-variants (part-style d))) + (style-properties (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* ([defaults (ormap (lambda (v) (and (html-defaults? v) v)) - (style-variants (part-style d)))] + (style-properties (part-style d)))] [prefix-file (or prefix-file (and defaults (let ([v (html-defaults-prefix-path defaults)]) @@ -857,7 +857,7 @@ (not (style-name style)) (null? attrs)) contents - `((,(if (memq 'div (style-variants style)) 'div 'p) + `((,(if (memq 'div (style-properties style)) 'div 'p) [,@attrs ,@(case (style-name style) [(author) '([class "author"])] @@ -919,15 +919,15 @@ ,@sz ,@(attribs)))))] [(and (or (element? e) (multiarg-element? e)) - (ormap (lambda (v) (and (script-variant? v) v)) + (ormap (lambda (v) (and (script-property? v) v)) (let ([s (if (element? e) (element-style e) (multiarg-element-style e))]) - (if (style? s) (style-variants s) null)))) + (if (style? s) (style-properties s) null)))) => (lambda (v) - (let* ([t `[type ,(script-variant-type v)]] - [s (script-variant-script v)] + (let* ([t `[type ,(script-property-type v)]] + [s (script-property-script v)] [s (if (list? s) `(script (,t ,@(attribs)) ,(apply as-literal `("\n" ,@s "\n"))) `(script (,t ,@(attribs) [src ,s])))]) @@ -1002,20 +1002,20 @@ (define/private (render-plain-content e part ri) (define (attribs) (content-attribs e)) - (let* ([variants (let ([s (content-style e)]) - (if (style? s) - (style-variants s) - null))] + (let* ([properties (let ([s (content-style e)]) + (if (style? s) + (style-properties s) + null))] [name (let ([s (content-style e)]) (if (style? s) (style-name s) s))] - [link? (and (ormap target-url? variants) + [link? (and (ormap target-url? properties) (not (current-no-links)))] - [anchor? (ormap url-anchor? variants)] + [anchor? (ormap url-anchor? properties)] [attribs (append - (if (null? variants) + (if (null? properties) null (append-map (lambda (v) (cond @@ -1027,7 +1027,7 @@ (from-root addr (get-dest-directory)) addr))]))] [else null])) - variants)) + properties)) (attribs))] [newline? (eq? name 'newline)]) (let-values ([(content) (cond @@ -1050,7 +1050,7 @@ (if (url-anchor? v) `((a ([name ,(url-anchor-name v)]))) null)) - variants) + properties) null) (,(cond [link? 'a] @@ -1098,16 +1098,16 @@ (cons `(td (,@(cond [(not column-style) null] - [(memq 'right (style-variants column-style)) '([align "right"])] - [(memq 'left (style-variants column-style)) '([align "left"])] - [(memq 'center (style-variants column-style)) '([align "center"])] + [(memq 'right (style-properties column-style)) '([align "right"])] + [(memq 'left (style-properties column-style)) '([align "left"])] + [(memq 'center (style-properties column-style)) '([align "center"])] [else null]) ,@(cond [(not column-style) null] - [(memq 'top (style-variants column-style)) '([valign "top"])] - [(memq 'baseline (style-variants column-style)) '([valign "baseline"])] - [(memq 'vcenter (style-variants column-style)) '([valign "center"])] - [(memq 'bottom (style-variants column-style)) '([valign "bottom"])] + [(memq 'top (style-properties column-style)) '([valign "top"])] + [(memq 'baseline (style-properties column-style)) '([valign "baseline"])] + [(memq 'vcenter (style-properties column-style)) '([valign "center"])] + [(memq 'bottom (style-properties column-style)) '([valign "bottom"])] [else null]) ,@(if (and column-style (string? (style-name column-style))) @@ -1124,7 +1124,7 @@ [else n])))]) null)) ,@(if (and (paragraph? d) - (memq 'omitable (style-variants (paragraph-style d)))) + (memq 'omitable (style-properties (paragraph-style d)))) (render-content (paragraph-content d) part ri) (render-block d part ri #f))) (loop (cdr ds) (cdr column-styles) #f)))])))) diff --git a/collects/scribble/latex-variants.ss b/collects/scribble/latex-properties.ss similarity index 100% rename from collects/scribble/latex-variants.ss rename to collects/scribble/latex-properties.ss diff --git a/collects/scribble/latex-render.ss b/collects/scribble/latex-render.ss index 8382ebac18..fa202edef6 100644 --- a/collects/scribble/latex-render.ss +++ b/collects/scribble/latex-render.ss @@ -1,7 +1,7 @@ #lang scheme/base (require "core.ss" - "latex-variants.ss" + "latex-properties.ss" "private/render-utils.ss" scheme/class scheme/runtime-path @@ -52,7 +52,7 @@ (define/override (render-one d ri fn) (let* ([defaults (ormap (lambda (v) (and (latex-defaults? v) v)) - (style-variants (part-style d)))] + (style-properties (part-style d)))] [prefix-file (or prefix-file (and defaults (let ([v (latex-defaults-prefix defaults)]) @@ -184,7 +184,7 @@ [(1) "Chap"] [else "Sec"]) (if (let ([s (element-style e)]) - (and (style? s) (memq 'uppercase (style-variants s)))) + (and (style? s) (memq 'uppercase (style-properties s)))) "UC" "")) (render-content @@ -249,7 +249,7 @@ [else (error 'latex-render "unrecognzied style symbol: ~s" style)])] [(string? style-name) - (let* ([v (if style (style-variants style) null)] + (let* ([v (if style (style-properties style) null)] [tt? (cond [(memq 'tt-chars v) #t] [(memq 'exact-chars v) 'exact] @@ -267,7 +267,7 @@ (wrap e style-name tt?)]))] [else (core-render e tt?)])) - (let loop ([l (if style (style-variants style) null)] [tt? #f]) + (let loop ([l (if style (style-properties style) null)] [tt? #f]) (if (null? l) (finish tt?) (let ([v (car l)]) @@ -276,16 +276,16 @@ (printf "\\href{~a}{" (target-url-addr v)) (loop (cdr l) #t) (printf "}")] - [(color-variant? v) + [(color-property? v) (printf "\\intext~acolor{~a}{" - (if (string? (color-variant-color v)) "" "rgb") - (color->string (color-variant-color v))) + (if (string? (color-property-color v)) "" "rgb") + (color->string (color-property-color v))) (loop (cdr l) tt?) (printf "}")] - [(background-color-variant? v) + [(background-color-property? v) (printf "\\in~acolorbox{~a}{" - (if (string? (background-color-variant-color v)) "" "rgb") - (color->string (background-color-variant-color v))) + (if (string? (background-color-property-color v)) "" "rgb") + (color->string (background-color-property-color v))) (loop (cdr l) tt?) (printf "}")] [else (loop (cdr l) tt?)])))))) @@ -345,7 +345,7 @@ (not (ormap (lambda (cell-styles) (ormap (lambda (s) (or (string? (style-name s)) - (let ([l (style-variants s)]) + (let ([l (style-properties s)]) (or (memq 'right l) (memq 'center l))))) cell-styles)) @@ -401,8 +401,8 @@ (map (lambda (i cell-style) (format "~a@{}" (cond - [(memq 'center (style-variants cell-style)) "c"] - [(memq 'right (style-variants cell-style)) "r"] + [(memq 'center (style-properties cell-style)) "c"] + [(memq 'right (style-properties cell-style)) "r"] [else "l"]))) (car blockss) (car cell-styless))) @@ -446,8 +446,8 @@ null) (define/private (render-table-cell p part ri twidth vstyle) - (let ([top? (memq 'top (style-variants vstyle))] - [center? (memq 'vcenter (style-variants vstyle))]) + (let ([top? (memq 'top (style-properties vstyle))] + [center? (memq 'vcenter (style-properties vstyle))]) (when (style-name vstyle) (printf "\\~a{" (style-name vstyle))) (let ([minipage? (and (not (table? p)) @@ -498,7 +498,7 @@ (or (and (string? s) s) (and (eq? s 'inset) "quote"))) "Subflow")] - [command? (memq 'command (style-variants (nested-flow-style t)))]) + [command? (memq 'command (style-properties (nested-flow-style t)))]) (if command? (printf "\\~a{" kind) (printf "\\begin{~a}" kind)) @@ -517,7 +517,7 @@ (define/override (render-compound-paragraph t part ri starting-item?) (let ([kind (style-name (compound-paragraph-style t))] - [command? (memq 'command (style-variants (compound-paragraph-style t)))]) + [command? (memq 'command (style-properties (compound-paragraph-style t)))]) (when kind (if command? (printf "\\~a{" kind) diff --git a/collects/scribble/private/defaults.ss b/collects/scribble/private/defaults.ss index 9a1016862e..8da11ff0e6 100644 --- a/collects/scribble/private/defaults.ss +++ b/collects/scribble/private/defaults.ss @@ -1,24 +1,24 @@ #lang scheme/base (require scribble/core - scribble/latex-variants + scribble/latex-properties setup/main-collects) (provide scribble-file add-defaults) -(define (add-variant variants pred new) - (if (ormap pred variants) - variants - (cons new variants))) +(define (add-property properties pred new) + (if (ormap pred properties) + properties + (cons new properties))) (define (scribble-file s) (path->main-collects-relative (build-path (collection-path "scribble") s))) (define (add-defaults doc pfx styl extras version?) (struct-copy part doc [style (make-style (style-name (part-style doc)) - ((if version? add-variant (lambda (x y z) x)) - (add-variant - (style-variants (part-style doc)) + ((if version? add-property (lambda (x y z) x)) + (add-property + (style-properties (part-style doc)) latex-defaults? (make-latex-defaults pfx diff --git a/collects/scribble/private/render-utils.ss b/collects/scribble/private/render-utils.ss index 3e08cd9a4d..df1d232747 100644 --- a/collects/scribble/private/render-utils.ss +++ b/collects/scribble/private/render-utils.ss @@ -7,7 +7,7 @@ empty-content?) (define (part-style? p s) - (memq s (style-variants (part-style p)))) + (memq s (style-properties (part-style p)))) (define (select-suffix path suggested-suffixes accepted-suffixes) (or (ormap (lambda (suggested) @@ -23,7 +23,7 @@ path)) (define (extract-table-cell-styles t) - (let ([vars (style-variants (table-style t))]) + (let ([vars (style-properties (table-style t))]) (or (let ([l (ormap (lambda (v) (and (table-cells? v) (table-cells-styless v))) @@ -31,12 +31,12 @@ (and l (unless (= (length l) (length (table-blockss t))) (error 'table - "table-cells variant list's length does not match row count: ~e vs. ~e" + "table-cells property list's length does not match row count: ~e vs. ~e" l (length (table-blockss t)))) (for-each (lambda (l row) (unless (= (length l) (length row)) (error 'table - "table-cells variant list contains a row whose length does not match the content: ~e vs. ~e" + "table-cells property list contains a row whose length does not match the content: ~e vs. ~e" l (length row)))) l (table-blockss t)) l)) @@ -46,7 +46,7 @@ (map (lambda (row) (unless (= (length cols) (length row)) (error 'table - "table-columns variant list's length does not match a row length: ~e vs. ~e" + "table-columns property list's length does not match a row length: ~e vs. ~e" cols (length row))) cols) (table-blockss t))))) diff --git a/collects/scribble/scheme.ss b/collects/scribble/scheme.ss index c1fae37133..1aec663b0d 100644 --- a/collects/scribble/scheme.ss +++ b/collects/scribble/scheme.ss @@ -2,8 +2,8 @@ (require "core.ss" "basic.ss" "search.ss" - "html-variants.ss" - "latex-variants.ss" + "html-properties.ss" + "latex-properties.ss" mzlib/class mzlib/for setup/main-collects @@ -53,7 +53,7 @@ make-element-id-transformer element-id-transformer?)) - (define scheme-variants + (define scheme-properties (let ([abs (lambda (s) (path->main-collects-relative (build-path (collection-path "scribble") s)))]) (list (make-css-addition (abs "scheme.css")) @@ -61,8 +61,8 @@ (define (make-scheme-style s #:tt? [tt? #t]) (make-style s (if tt? - (cons 'tt-chars scheme-variants) - scheme-variants))) + (cons 'tt-chars scheme-properties) + scheme-properties))) (define output-color (make-scheme-style "ScmOut")) (define input-color (make-scheme-style "ScmIn")) diff --git a/collects/scribble/sigplan.ss b/collects/scribble/sigplan.ss index 4999d26d26..4f453f4718 100644 --- a/collects/scribble/sigplan.ss +++ b/collects/scribble/sigplan.ss @@ -3,8 +3,8 @@ scribble/core scribble/base scribble/decode - scribble/html-variants - scribble/latex-variants + scribble/html-properties + scribble/latex-properties (for-syntax scheme/base)) (provide preprint diff --git a/collects/scribble/struct.ss b/collects/scribble/struct.ss index a9e515f80a..d0b481e9c3 100644 --- a/collects/scribble/struct.ss +++ b/collects/scribble/struct.ss @@ -4,7 +4,7 @@ deserialize-info:target-url-v0) [make-target-url core:make-target-url]) "private/provide-structs.ss" - "html-variants.ss" + "html-properties.ss" scheme/provide-syntax scheme/struct-info scheme/contract @@ -180,12 +180,12 @@ (make-style (style-name s) (cons (make-document-version version) - (style-variants s)))) + (style-properties s)))) to-collect (flow-paragraphs flow) parts)) (define (versioned-part? p) - (and (part? p) (ormap document-version? (style-variants (part-style p))))) + (and (part? p) (ormap document-version? (style-properties (part-style p))))) (define (make-unnumbered-part tag-prefix tags title-content orig-style to-collect flow parts) (make-part tag-prefix @@ -193,12 +193,12 @@ (list->content title-content) (let ([s (convert-style orig-style)]) (make-style (style-name s) - (cons 'unnumbered (style-variants s)))) + (cons 'unnumbered (style-properties s)))) to-collect (flow-paragraphs flow) parts)) (define (unnumbered-part? p) - (and (part? p) (memq 'unnumbered (style-variants (part-style p))))) + (and (part? p) (memq 'unnumbered (style-properties (part-style p))))) (define (make-paragraph/compat content) (make-paragraph plain (list->content content))) @@ -210,7 +210,7 @@ (define (make-omitable-paragraph content) (make-paragraph (make-style #f '(omitable)) (list->content content))) (define (omitable-paragraph? p) - (and (paragraph? p) (memq 'omitable (style-variants (paragraph-style p))))) + (and (paragraph? p) (memq 'omitable (style-properties (paragraph-style p))))) (define (make-table/compat style cellss) (make-table (convert-style style) @@ -230,11 +230,11 @@ (let ([t (make-table/compat style cells)]) (make-table (make-style (style-name (table-style t)) (cons 'aux - (style-variants (table-style t)))) + (style-properties (table-style t)))) (table-blockss t)))) (define (auxiliary-table? t) - (ormap (lambda (v) (eq? v 'aux) (style-variants (table-style t))))) + (ormap (lambda (v) (eq? v 'aux) (style-properties (table-style t))))) (define (make-itemization/compat flows) (make-itemization plain flows)) @@ -251,18 +251,18 @@ (if (style? s) (style-name s) s)) -(define (element-style-variants s) +(define (element-style-properties s) (if (style? s) - (style-variants s) + (style-properties s) null)) -(define (add-element-variant v e) +(define (add-element-property v e) (make-element (make-style (element-style-name (element-style e)) (cons v - (element-style-variants (element-style e)))) + (element-style-properties (element-style e)))) (element-content e))) (define (check-element-style e pred) - (ormap pred (style-variants (element-style e)))) + (ormap pred (style-properties (element-style e)))) (define (handle-image-style ctr style . args) (if (image-file? style) @@ -310,33 +310,33 @@ (handle-image-style make-index-element style (list->content content) tag plain-seq etry-seq desc)) (define (make-aux-element style content) - (add-element-variant 'aux (make-element/compat style content))) + (add-element-property 'aux (make-element/compat style content))) (define (aux-element? e) (check-element-style e (lambda (v) (eq? v 'aux)))) (define (make-hover-element style content text) - (add-element-variant (make-hover-variant text) - (make-element/compat style content))) + (add-element-property (make-hover-property text) + (make-element/compat style content))) (define (hover-element? e) - (check-element-style e hover-variant?)) + (check-element-style e hover-property?)) (define (hover-element-text e) (ormap (lambda (v) - (and (hover-variant? v) (hover-variant-text e))) - (style-variants (element-style e)))) + (and (hover-property? v) (hover-property-text e))) + (style-properties (element-style e)))) (define (make-script-element style content type script) - (add-element-variant (make-script-variant type script) - (make-element/compat style content))) + (add-element-property (make-script-property type script) + (make-element/compat style content))) (define (script-element? e) - (check-element-style e script-variant?)) + (check-element-style e script-property?)) (define (script-element-type e) (ormap (lambda (v) - (and (script-variant? v) (script-variant-type e))) - (style-variants (element-style e)))) + (and (script-property? v) (script-property-type e))) + (style-properties (element-style e)))) (define (script-element-script e) (ormap (lambda (v) - (and (script-variant? v) (script-variant-script e))) - (style-variants (element-style e)))) + (and (script-property? v) (script-property-script e))) + (style-properties (element-style e)))) ;; ---------------------------------------- @@ -352,18 +352,18 @@ (make-style (style-name s) (cons (make-attributes (with-attributes-assoc wa)) - (style-variants s))))] + (style-properties s))))] [(target-url? s) (let ([s (convert-style (target-url-style s))]) (make-style (style-name s) (cons (core:make-target-url (target-url-addr s)) - (style-variants s))))] + (style-properties s))))] [(image-file? s) (make-style #f null)] [(and (list? s) (pair? s) (eq? (car s) 'color)) - (make-style #f (list (make-color-variant + (make-style #f (list (make-color-property (if (string? (cadr s)) (cadr s) (cdr s)))))] [(and (list? s) (pair? s) (eq? (car s) 'bg-color)) - (make-style #f (list (make-background-color-variant + (make-style #f (list (make-background-color-property (if (string? (cadr s)) (cadr s) (cdr s)))))] [(and (pair? s) (list? s) diff --git a/collects/scribblings/main/private/make-search.ss b/collects/scribblings/main/private/make-search.ss index 888665b581..483d41466e 100644 --- a/collects/scribblings/main/private/make-search.ss +++ b/collects/scribblings/main/private/make-search.ss @@ -6,7 +6,7 @@ scribble/basic scribble/core scribble/scheme - scribble/html-variants + scribble/html-properties scribble/manual-struct scheme/list scheme/string diff --git a/collects/scribblings/main/private/utils.ss b/collects/scribblings/main/private/utils.ss index 6563e48461..64b1f426a7 100644 --- a/collects/scribblings/main/private/utils.ss +++ b/collects/scribblings/main/private/utils.ss @@ -4,7 +4,7 @@ (require "../config.ss" scribble/manual scribble/core - scribble/html-variants + scribble/html-properties scribble/decode scheme/list setup/dirs) @@ -19,14 +19,14 @@ (define (script #:noscript [noscript null] . body) (make-element (make-style #f (list - (make-script-variant + (make-script-property "text/javascript" (flatten body)))) noscript)) (define (script-ref #:noscript [noscript null] path) (make-element (make-style #f (list - (make-script-variant + (make-script-property "text/javascript" path))) noscript)) diff --git a/collects/scribblings/reference/help.scrbl b/collects/scribblings/reference/help.scrbl index 077f3e6266..7e2d4dc906 100644 --- a/collects/scribblings/reference/help.scrbl +++ b/collects/scribblings/reference/help.scrbl @@ -1,7 +1,7 @@ #lang scribble/doc @(require "mz.ss" scribble/core - scribble/html-variants + scribble/html-properties (for-label scheme/help net/url scheme/gui)) diff --git a/collects/scribblings/reference/reference.scrbl b/collects/scribblings/reference/reference.scrbl index d9a0300eff..6d665f7005 100644 --- a/collects/scribblings/reference/reference.scrbl +++ b/collects/scribblings/reference/reference.scrbl @@ -1,8 +1,8 @@ #lang scribble/doc @(require "mz.ss" scribble/core - scribble/html-variants - scribble/latex-variants + scribble/html-properties + scribble/latex-properties scribble/core scheme/list) diff --git a/collects/scribblings/scribble/base.scrbl b/collects/scribblings/scribble/base.scrbl index 8a7312fc3f..30d54df0c5 100644 --- a/collects/scribblings/scribble/base.scrbl +++ b/collects/scribblings/scribble/base.scrbl @@ -75,7 +75,7 @@ from the content. The tag string is combined with the symbol The @scheme[style] argument can be a style structure, or it can be one of the following: a @scheme[#f] that corresponds to a ``plain'' style, a string that is used as a @tech{style name}, a symbol that is used as -a @tech{variant}, or a list of symbols to be used as @tech{variants}. +a @tech{style property}, or a list of symbols to be used as @tech{style properties}. For information on styles, see @scheme[part]. For example, a style of @scheme['toc] causes sub-sections to be generated as separate pages in multi-page HTML output. @@ -350,7 +350,7 @@ Generates a literal hyperlinked URL.} element?]{ Inserts the hyperlinked title of the section tagged @scheme[tag], but -elements in the title content with the @scheme['aux] @tech{variant} +elements in the title content with the @scheme['aux] @tech{style property} are omitted in the hyperlink label. If @scheme[#:doc module-path] is provided, the @scheme[tag] refers to diff --git a/collects/scribblings/scribble/config.scrbl b/collects/scribblings/scribble/config.scrbl index ed8e92dbc8..51bb08f059 100644 --- a/collects/scribblings/scribble/config.scrbl +++ b/collects/scribblings/scribble/config.scrbl @@ -2,8 +2,8 @@ @(require scribble/manual scribble/core scribble/decode - scribble/html-variants - scribble/latex-variants + scribble/html-properties + scribble/latex-properties "utils.ss" (for-label scheme/base)) @@ -20,7 +20,7 @@ extend or configure Scribble fall into two groups: @item{You may need to drop into the back-end ``language'' of CSS or Latex to create a specific output effect. For this kind of extension, you will mostly likely attach a - @scheme[css-addition] or @scheme[tex-addition] @tech{variant} + @scheme[css-addition] or @scheme[tex-addition] @tech{style property} to style, where the addition implements the style name. This kind of extension is described in @secref["extra-style"].} @@ -29,7 +29,7 @@ extend or configure Scribble fall into two groups: kind of configuration, you can run the @exec{scribble} command-line tool and supply flags like @DFlag{prefix} or @DPFlag{style}, or you can associate a @scheme[html-defaults] or - @scheme[latex-defaults] @tech{variant} to the main document's + @scheme[latex-defaults] @tech{style property} to the main document's style. This kind of configuration is described in @secref["config-style"].} @@ -50,7 +50,7 @@ output or a Latex macro/environment for Latex output. In Latex output, the string is used as a command name for a @scheme[paragraph] and an environment name for a @scheme[table], @scheme[itemization], @scheme[nested-flow], or @scheme[compound-paragraph]; the if style has -a @scheme['commad] @tech{variant} for a @scheme[nested-flow] or +a @scheme['command] @tech{style property} for a @scheme[nested-flow] or @scheme[compound-paragraph], then the style name is used as a command instead of an environment. In addition, for an itemization, the style string is suffixed with @scheme["Item"] and used as a CSS class or Latex @@ -58,7 +58,7 @@ macro name to use for the itemization's items (in place of @tt{item} in the case of Latex). To add a mapping from your own style name to a CSS configuration, add -a @scheme[css-addition] structure instance to a style's @tech{variant} +a @scheme[css-addition] structure instance to a style's @tech{style property} list. To map a style name to a Latex macro or environment, add a scheme[tex-addition] structure instance. A @scheme[css-addition] or @scheme[tex-addition] is normally associated with the style whose name @@ -75,7 +75,7 @@ The styles used by @schememodname[scribble/manual] are implemented by @filepath{scribble} collection. Other libraries, such as @schememodname[scriblib/autobib], similarly implement styles through files that are associated by @scheme[css-addition] and @scheme[tex-addition] -@tech{variants}. +@tech{style properties}. To avoid collisions with future additions to Scribble, start your style name with an uppercase letter that is not @litchar{S}. An @@ -88,8 +88,8 @@ For example, a Scribble document @verbatim[#:indent 2]|{ #lang scribble/manual @(require scribble/core - scribble/html-variants - scribble/latex-variants) + scribble/html-properties + scribble/latex-properties) (define inbox-style (make-style "InBox" @@ -191,13 +191,13 @@ accompanying files: When using the @exec{scribble} command-line utility, a document can declare its default style, prefix, and extra files through a -@scheme[html-defaults] and/or @scheme[latex-defaults] style -@tech{variant}. In particular, when using the @exec{scribble} +@scheme[html-defaults] and/or @scheme[latex-defaults] +@tech{style property}. In particular, when using the @exec{scribble} command-line tool to generate Latex or PDF a document whose main part is implemented with @scheme[#, @hash-lang[] #, @schememodname[scribble/manual]], the result has the standard PLT Scheme manual configuration, because @schememodname[scribble/manual] -associates a @scheme[latex-defaults] @tech{variant} with the exported +associates a @scheme[latex-defaults] @tech{style property} with the exported document. The @schememodname[scribble/sigplan] language similarly associates a default configuration with an exported document. As libraries imported with @scheme[require], however, @@ -205,10 +205,10 @@ libraries imported with @scheme[require], however, simply implement new styles in a composable way. Whether or not a document has a default prefix- and style-file -configuration through a style @tech{variant}, the defaults can be +configuration through a @tech{style property}, the defaults can be overridden using @exec{scribble} command-line flags. Furthermore, languages like @schememodname[scribble/manual] and @schememodname[scribble/sigplan] add a @scheme[html-defaults] and/or -@scheme[latex-defaults] @tech{variant} to a main-document part only if -it does not already have such a variant added through the +@scheme[latex-defaults] @tech{style property} to a main-document part only if +it does not already have such a property added through the @scheme[#:style] argument of @scheme[title]. diff --git a/collects/scribblings/scribble/core.scrbl b/collects/scribblings/scribble/core.scrbl index 2c5c570443..cda62c2f9f 100644 --- a/collects/scribblings/scribble/core.scrbl +++ b/collects/scribblings/scribble/core.scrbl @@ -195,10 +195,10 @@ example, @scheme[section] and @scheme[secref] both accept a string @section[#:tag "style"]{Styles} A @deftech{style} combines a @tech{style name} with a list of -@tech{variants} in a @scheme[style] structure. A @deftech{style name} -is either a string, symbol, of @scheme[#f]. A @deftech{variant} can be +@tech{style properties} in a @scheme[style] structure. A @deftech{style name} +is either a string, symbol, of @scheme[#f]. A @deftech{style property} can be anything, including a symbol a structure such as -@scheme[color-variant]. +@scheme[color-property]. A style has a single @tech{style name}, because the name typically corresponds to a configurable instruction to a renderer. For example, @@ -210,11 +210,11 @@ layer of abstraction between the renderer and documents for widely supported style; for example, the @scheme['italic] style name is supported by all renderers. -@tech{Variants} within a style compose with style names and other -variants. Again, symbols are often used for variants that are directly +@tech{Style properties} within a style compose with style names and other +properties. Again, symbols are often used for properties that are directly supported by renderers. For example, @scheme['unnumbered] style -variant for a @tech{part} renders the part without a section number. -Many variants are renderer-specific, such as a @scheme[hover-variant] +property for a @tech{part} renders the part without a section number. +Many properties are renderer-specific, such as a @scheme[hover-property] structure that associates text with an element to be shown in an HTML display when the mouse hovers over the text. @@ -285,7 +285,7 @@ names are as follows: ] -The recognized @tech{variants} are as follows: +The recognized @tech{style properties} are as follows: @itemize[ @@ -369,7 +369,7 @@ recognized: ] -The currently recognized style @tech{variants} are as follows: +The currently recognized @tech{style properties} are as follows: @itemize[ @@ -410,13 +410,13 @@ recognized: ] -The following style @tech{variants} are currently recognized: +The following @tech{style properties} are currently recognized: @itemize[ @item{@scheme[table-columns] structure --- Provides column-specific styles, but only if a @scheme[table-cells] structure is not - included as a @tech{variant}.} + included as a @tech{style property}.} @item{@scheme[table-cells] structure --- Provides cell-specific styles.} @@ -434,8 +434,8 @@ The following style @tech{variants} are currently recognized: For Latex output, a paragraph as a cell value is not automatically line-wrapped, unless a vertical alignment is specified for the cell -through a @scheme[table-cells] or @scheme[table-columns] style -@tech{variant}. To get a line-wrapped paragraph, use a +through a @scheme[table-cells] or @scheme[table-columns] +@tech{style property}. To get a line-wrapped paragraph, use a @scheme[compound-paragraph] or use an element with a string style and define a corresponding Latex macro in terms of @tt{parbox}. For Latex output of blocks in the flow that are @scheme[nested-flow]s, @@ -463,7 +463,7 @@ names are recognized: itemization.} ] -The following style @tech{variants} are currently recognized: +The following @tech{style properties} are currently recognized: @itemize[ @@ -493,7 +493,7 @@ names are recognized: ] -The following style @tech{variants} are currently recognized: +The following @tech{style properties} are currently recognized: @itemize[ @@ -522,8 +522,8 @@ non-@scheme[#f] @tech{style name}. The @scheme[style] field of a compound paragraph is normally a string that corresponds to a CSS class for HTML output or Latex environment -for Latex output (see @secref["extra-style"]). The following style -@tech{variants} are currently recognized: +for Latex output (see @secref["extra-style"]). The following +@tech{style properties} are currently recognized: @itemize[ @@ -577,7 +577,7 @@ recognized: ] -The following style @tech{variants} are currently recognized: +The following @tech{style properties} are currently recognized: @itemize[ @@ -586,20 +586,20 @@ The following style @tech{variants} are currently recognized: @item{@scheme[url-anchor] structure --- For HTML, inserts a hyperlink target before @scheme[content].} - @item{@scheme[color-variant] structure --- Applies a color to the + @item{@scheme[color-property] structure --- Applies a color to the text of @scheme[content].} - @item{@scheme[background-color-variant] structure --- Applies a color to the + @item{@scheme[background-color-property] structure --- Applies a color to the background of @scheme[content].} @item{@scheme[attributes] structure --- Provides additional HTML attributes for a @tt{} tag.} - @item{@scheme[hover-variant] structure --- For HTML, adds a text + @item{@scheme[hover-property] structure --- For HTML, adds a text label to the content to be shown when the mouse hovers over it.} - @item{@scheme[script-variant] structure --- For HTML, supplies a + @item{@scheme[script-property] structure --- For HTML, supplies a script alternative to @scheme[content].} @item{@scheme[body-id] structure --- For HTML uses the given @@ -675,7 +675,7 @@ When @scheme[tag] is a part tag and the content of the element is @scheme[null], then the hyperlink uses the target part's number and/or title as the content. In that case, if the section number is preceded by a word, the word starts in uppercase if the element's style includes a -@scheme['uppercase] variant.} +@scheme['uppercase] property.} @defstruct[(index-element element) ([tag tag?] @@ -781,20 +781,20 @@ Computed for each part by the @techlink{collect pass}.} @defstruct[target-url ([addr path-string?])]{ -Used as a style @tech{variant} for an @scheme[element]. A path is +Used as a @tech{style property} for an @scheme[element]. A path is allowed for @scheme[addr], but a string is interpreted as a URL rather than a file path.} @defstruct[document-version ([text (or/c string? false/c)])]{ -Used as a style @tech{variant} for a @scheme[path] to indicate a +Used as a @tech{style property} for a @scheme[path] to indicate a version number.} -@defstruct[color-variant ([color (or/c string? (list/c byte? byte? byte?))])]{ +@defstruct[color-property ([color (or/c string? (list/c byte? byte? byte?))])]{ -Used as a style @tech{variant} for an @scheme[element] to set its +Used as a @tech{style property} for an @scheme[element] to set its color. Recognized string names for @scheme[color] depend on the renderer, but at the recognized set includes at least @scheme["white"], @scheme["black"], @scheme["red"], @scheme["green"], @@ -803,19 +803,19 @@ renderer, but at the recognized set includes at least are used as RGB levels.} -@defstruct[background-color-variant ([color (or/c string? (list/c byte? byte? byte?))])]{ +@defstruct[background-color-property ([color (or/c string? (list/c byte? byte? byte?))])]{ -Like @scheme[color-variant], but sets the background color.} +Like @scheme[color-property], but sets the background color.} @defstruct[table-cells ([styless (listof (listof style?))])]{ -Used as a style @tech{variant} for a @scheme[table] to set its cells' +Used as a @tech{style property} for a @scheme[table] to set its cells' styles. If a cell style has a string name, it is used as an HTML class for the @tt{