From 229e2636de7d5ee4ac77f209e9fae2a9f926afc3 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 27 Jul 2009 03:55:43 +0000 Subject: [PATCH] change scribble 'variant' to 'property'; add contracts in scribble/decode svn: r15581 --- collects/scribble/base-render.ss | 8 +- collects/scribble/base.ss | 4 +- collects/scribble/core.ss | 10 +- collects/scribble/decode.ss | 55 ++++++--- .../{html-variants.ss => html-properties.ss} | 6 +- collects/scribble/html-render.ss | 66 +++++----- ...{latex-variants.ss => latex-properties.ss} | 0 collects/scribble/latex-render.ss | 36 +++--- collects/scribble/private/defaults.ss | 16 +-- collects/scribble/private/render-utils.ss | 10 +- collects/scribble/scheme.ss | 10 +- collects/scribble/sigplan.ss | 4 +- collects/scribble/struct.ss | 60 ++++----- .../scribblings/main/private/make-search.ss | 2 +- collects/scribblings/main/private/utils.ss | 6 +- collects/scribblings/reference/help.scrbl | 2 +- .../scribblings/reference/reference.scrbl | 4 +- collects/scribblings/scribble/base.scrbl | 4 +- collects/scribblings/scribble/config.scrbl | 30 ++--- collects/scribblings/scribble/core.scrbl | 114 +++++++++--------- collects/scribblings/scribble/decode.scrbl | 49 +++++--- .../scribblings/scribble/how-to-paper.scrbl | 9 +- collects/scribblings/scribble/lp.scrbl | 4 +- collects/scribblings/scribble/manual.scrbl | 6 +- .../scribblings/scribble/preprocessor.scrbl | 2 +- collects/scribblings/scribble/struct.scrbl | 26 ++-- collects/scribblings/scribble/utils.ss | 8 +- collects/scriblib/autobib.ss | 4 +- collects/scriblib/figure.ss | 17 +-- collects/scriblib/scribblings/figure.scrbl | 24 ++-- collects/setup/scribble.ss | 4 +- src/mzscheme/src/schvers.h | 4 +- 32 files changed, 326 insertions(+), 278 deletions(-) rename collects/scribble/{html-variants.ss => html-properties.ss} (81%) rename collects/scribble/{latex-variants.ss => latex-properties.ss} (100%) 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{} tag or as a Latex command name. -The following symbols are recognized as cell-style @tech{variants}: +The following symbols are recognized as cell-@tech{style properties}: @itemize[ @@ -839,8 +839,8 @@ The following symbols are recognized as cell-style @tech{variants}: @defstruct[table-columns ([styles (listof style?)])]{ Like @scheme[table-cells], but the @scheme[styles] list is duplicated -for each row in the table. This @tech{variant} is only when a -@scheme[table-cells] is not present in a style's list of variants.} +for each row in the table. This @tech{style property} is only when a +@scheme[table-cells] is not present in a style's list of properties.} @defproc[(block? [v any/c]) boolean?]{ @@ -858,7 +858,7 @@ otherwise.} @defstruct[style ([name (or/c string? symbol? #f)] - [variants list?])]{ + [properties list?])]{ Represents a @techlink{style}.} @@ -1036,43 +1036,43 @@ Converts a @scheme[generated-tag] value with @scheme[t] to a string. @; ---------------------------------------- -@section{HTML Style Variants} +@section{HTML Style Properties} -@defmodule[scribble/html-variants]{ The -@scheme[scribble/html-variants] library provides datatypes used as -style @tech{variants} for HTML rendering.} +@defmodule[scribble/html-properties]{ The +@scheme[scribble/html-properties] library provides datatypes used as +@tech{style properties} for HTML rendering.} @defstruct[attributes ([assoc (listof (cons/c symbol? string?))])]{ -Used as a style @tech{variant} to add arbitrary attributes to an HTML +Used as a @tech{style property} to add arbitrary attributes to an HTML tag.} @defstruct[url-anchor ([name string?])]{ -Used as a style @tech{variant} with @scheme[element] to insert an +Used as a @tech{style property} with @scheme[element] to insert an anchor before the element.} -@defstruct[hover-variant ([text string?])]{ +@defstruct[hover-property ([text string?])]{ -Used as a style @tech{variant} with @scheme[element] to add text that +Used as a @tech{style property} with @scheme[element] to add text that is shown when the mouse hovers over the element.} -@defstruct[script-variant ([type string?] +@defstruct[script-property ([type string?] [script (or/c path-string? (listof string?))])]{ -Used as a style @tech{variant} with @scheme[element] to supply a +Used as a @tech{style property} with @scheme[element] to supply a script alternative to the element content.} @defstruct[css-addition ([path (or/c path-string? (cons/c 'collects (listof bytes?)))])]{ -Used as a style @tech{variant} to supply a CSS file to be referenced -in the generated HTML. This variant can be attached to any style, and +Used as a @tech{style property} to supply a CSS file to be referenced +in the generated HTML. This property can be attached to any style, and all additions are collected to the top of the generated HTML page. The @scheme[path] field can be a result of @@ -1081,7 +1081,7 @@ The @scheme[path] field can be a result of @defstruct[body-id ([value string?])]{ -Used as a style @tech{variant} to associate an @tt{id} attribute with +Used as a @tech{style property} to associate an @tt{id} attribute with an HTML tag.} @@ -1099,18 +1099,18 @@ Like @scheme[latex-defaults], but use for the @; ---------------------------------------- -@section{Latex Style Variants} +@section{Latex Style Properties} -@defmodule[scribble/latex-variants]{ The -@scheme[scribble/latex-variants] library provides datatypes used as -style @tech{variants} for Latex rendering.} +@defmodule[scribble/latex-properties]{ The +@scheme[scribble/latex-properties] library provides datatypes used as +@tech{style properties} for Latex rendering.} @defstruct[tex-addition ([path (or/c path-string? (cons/c 'collects (listof bytes?)))])]{ -Used as a style @tech{variant} to supply a @filepath{.tex} file to be -included in the generated Latex. This variant can be attached to any +Used as a @tech{style property} to supply a @filepath{.tex} file to be +included in the generated Latex. This property can be attached to any style, and all additions are collected to the top of the generated Latex file. @@ -1125,7 +1125,7 @@ The @scheme[path] field can be a result of [extra-files (listof (or/c path-string? (cons/c 'collects (listof bytes?))))])]{ -Used as a style @tech{variant} on the main @scheme[part] of a document +Used as a @tech{style property} on the main @scheme[part] of a document to set a default prefix file, style file, and extra files (see @secref["config-style"]). The defaults are used by the @exec{scribble} command-line tool for and @DFlag{latex} or @DFlag{pdf} @@ -1136,18 +1136,18 @@ be a result of @scheme[path->main-collects-relative]. Languages (used with @hash-lang[]) like @schememodname[scribble/manual] and @schememodname[scribble/sigplan] -add this variant to a document to specify appropriate files for Latex +add this property to a document to specify appropriate files for Latex rendering.} @defstruct[latex-auto-extra-files ([paths (listof (or/c path-string? (cons/c 'collects (listof bytes?))))])]{ -Used as a style @tech{variant} for the main @scheme[part] of a +Used as a @tech{style property} for the main @scheme[part] of a document to supply extra files needed to build the document via the @exec{scribble} command-line tool (for @DFlag{latex} and @DFlag{pdf} mode). Languages (used with @hash-lang[]) like -@schememodname[scribble/sigplan] add this variant to a document to specify +@schememodname[scribble/sigplan] add this property to a document to specify appropriate extra files.} diff --git a/collects/scribblings/scribble/decode.scrbl b/collects/scribblings/scribble/decode.scrbl index 436df85d45..07d46937ec 100644 --- a/collects/scribblings/scribble/decode.scrbl +++ b/collects/scribblings/scribble/decode.scrbl @@ -45,17 +45,6 @@ the @litchar{``apple''} argument is decoded to use fancy quotes, and then it is bolded. -@defproc[(pre-flow? [v any/c]) boolean?]{ - -Returns @scheme[#t] if @scheme[v] is a @deftech{pre-flow} value: a -string or other non-list @scheme[content], a @scheme[block?], or a -@scheme[splice] containing a list of @tech{pre-flow} values; otherwise -returns @scheme[#f]. - -Pre-flow is decoded into a @tech{flow} (i.e., a list of @tech{blocks}) -by functions like @scheme[decode] and @scheme[decode-flow].} - - @defproc[(pre-content? [v any/c]) boolean?]{ Returns @scheme[#t] if @scheme[v] is a @deftech{pre-content} value: a @@ -67,7 +56,31 @@ Pre-content is decoded into @tech{content} by functions like @scheme[decode-content] and @scheme[decode-paragraph].} -@defproc[(decode [lst list?]) part?]{ +@defproc[(pre-flow? [v any/c]) boolean?]{ + +Returns @scheme[#t] if @scheme[v] is a @deftech{pre-flow} value: a +string or other non-list @scheme[content], a @scheme[block], or a +@scheme[splice] containing a list of @tech{pre-flow} values; otherwise +returns @scheme[#f]. + +Pre-flow is decoded into a @tech{flow} (i.e., a list of @tech{blocks}) +by functions like @scheme[decode-flow].} + + +@defproc[(pre-part? [v any/c]) boolean?]{ + +Returns @scheme[#t] if @scheme[v] is a @deftech{pre-part} value: a +string or other non-list @scheme[content], a @scheme[block], a +@scheme[part], a @scheme[title-decl], a @scheme[part-start], a +@scheme[part-index-decl], a @scheme[part-collect-decl], a +@scheme[part-tag-decl], or a @scheme[splice] containing a list of +@tech{pre-part} values; otherwise returns @scheme[#f]. + +A pre-part sequences is decoded into a @scheme[part] by functions like +@scheme[decode] and @scheme[decode-part].} + + +@defproc[(decode [lst (listof pre-part?)]) part?]{ Decodes a document, producing a part. In @scheme[lst], instances of @scheme[splice] are inlined into the list. An instance of @@ -84,10 +97,10 @@ flow-element datatypes are used as-is in the enclosing flow. } -@defproc[(decode-part [lst list?] +@defproc[(decode-part [lst (listof pre-part?)] [tags (listof string?)] - [title (or/c false/c list?)] - [depth excat-nonnegative-integer?]) + [title (or/c #f list?)] + [depth exact-nonnegative-integer?]) part?]{ Like @scheme[decode], but given a list of tag string for the part, a @@ -146,9 +159,9 @@ otherwise. } -@defstruct[title-decl ([tag-prefix (or/c false/c string?)] +@defstruct[title-decl ([tag-prefix (or/c #f string?)] [tags (listof string?)] - [version (or/c string? false/c)] + [version (or/c string? #f)] [style any/c] [content content?])]{ @@ -159,7 +172,7 @@ and @scheme[style] fields are propagated to the resulting } @defstruct[part-start ([depth integer?] - [tag-prefix (or/c false/c string?)] + [tag-prefix (or/c #f string?)] [tags (listof string?)] [style any/c] [title content?])]{ diff --git a/collects/scribblings/scribble/how-to-paper.scrbl b/collects/scribblings/scribble/how-to-paper.scrbl index 5894e27802..991415d9dd 100644 --- a/collects/scribblings/scribble/how-to-paper.scrbl +++ b/collects/scribblings/scribble/how-to-paper.scrbl @@ -1,7 +1,8 @@ #lang scribble/doc @(require scribble/manual scribble/bnf - "utils.ss") + "utils.ss" + (for-label scriblib/figure)) @(define (sample . text) (nested #:style 'inset (apply verbatim text))) @(define (result . text) (apply nested #:style 'inset text)) @@ -155,7 +156,7 @@ into one document that is the same as before. @; ---------------------------------------- @section{Document Styles} -Scribble currently supports only one from of HTML output. You can +Scribble currently supports only one form of HTML output. You can replace the @filepath{scribble.css} file for the generated pages, and that's about it. (We expect to add more styles in the future.) @@ -466,7 +467,7 @@ For example the text-mode stream @section[#:tag "poetry"]{Of Mice and Cookies} See @secref["milk"]. - @section[#:tag "milk"]{@italic{Important} Things About Milk} + @section[#:tag "milk"]{@italic{Important} Stuff About Milk} @figure["straw" @elem{A straw}]{@image["straw.png"]} }| @@ -478,7 +479,7 @@ is equivalent to the Scheme-mode sequence (section #:tag "poetry" "Of Mice and Cookies") "\n" "See " (secref "milk") "." "\n" "\n" - (section #:tag "milk" (italic "Important") " Things About Milk") "\n" + (section #:tag "milk" (italic "Important") " Milk Supplies") "\n" (figure "straw" (elem "A straw") (image "straw.png")) "\n" ] diff --git a/collects/scribblings/scribble/lp.scrbl b/collects/scribblings/scribble/lp.scrbl index 6370bf1cf3..051aa33512 100644 --- a/collects/scribblings/scribble/lp.scrbl +++ b/collects/scribblings/scribble/lp.scrbl @@ -1,8 +1,8 @@ #lang scribble/doc @(require scribble/manual scribble/core - scribble/html-variants - scribble/latex-variants + scribble/html-properties + scribble/latex-properties scheme/runtime-path (prefix-in lp-ex: "lp-ex-doc.scrbl") "utils.ss" diff --git a/collects/scribblings/scribble/manual.scrbl b/collects/scribblings/scribble/manual.scrbl index 4f54699540..1edaf1a2af 100644 --- a/collects/scribblings/scribble/manual.scrbl +++ b/collects/scribblings/scribble/manual.scrbl @@ -20,10 +20,10 @@ bindings, but without setting the reader or setting the default rendering format to the PLT Scheme manual format.} With @hash-lang[], @schememodname[scribble/manual] associates a -@scheme[latex-defaults] style @tech{variant} with its @scheme[doc] +@scheme[latex-defaults] @tech{style property} with its @scheme[doc] export to select the default PLT Scheme manual style for Latex rendering---unless a style is supplied to @scheme[title] that already -includes a @scheme[latex-defaults] @tech{variant}. +includes a @scheme[latex-defaults] @tech{style property}. @local-table-of-contents[] @@ -819,7 +819,7 @@ as a member of the signature named by @scheme[sig-id].} @section[#:tag "doc-strings"]{Various String Forms} @defproc[(aux-elem [pre-content any/c] ...) element?]{ -Like @scheme[elem], but adds an @scheme['aux] style @tech{variant}.} +Like @scheme[elem], but adds an @scheme['aux] @tech{style property}.} @defproc[(defterm [pre-content any/c] ...) element?]{Typesets the @tech{decode}d @scheme[pre-content] as a defined term (e.g., in diff --git a/collects/scribblings/scribble/preprocessor.scrbl b/collects/scribblings/scribble/preprocessor.scrbl index 2cfa0a1a7c..e9278f9ac7 100644 --- a/collects/scribblings/scribble/preprocessor.scrbl +++ b/collects/scribblings/scribble/preprocessor.scrbl @@ -1,6 +1,6 @@ #lang scribble/doc @(require scribble/manual - scribble/core scribble/html-variants scribble/latex-variants + scribble/core scribble/html-properties scribble/latex-properties "utils.ss" (for-label scheme/base ;; FIXME: need to get this in diff --git a/collects/scribblings/scribble/struct.scrbl b/collects/scribblings/scribble/struct.scrbl index 2f0ad66536..2fceffa58b 100644 --- a/collects/scribblings/scribble/struct.scrbl +++ b/collects/scribblings/scribble/struct.scrbl @@ -83,9 +83,9 @@ coerced to one.} )]{ @compat[] Like @scheme[make-part], but adds a the -@scheme[document-version] style @tech{variant} using the given +@scheme[document-version] @tech{style property} using the given @scheme[version]. The @scheme[versioned-part?] predicate recognizes a -@scheme[part] with a @scheme[document-version] variant.} +@scheme[part] with a @scheme[document-version] property.} @deftogether[( @defproc[(make-unnumbered-part [tag-prefix (or/c false/c string?)] @@ -100,8 +100,8 @@ coerced to one.} )]{ @compat[] Like @scheme[make-part], but adds the @scheme['unnumbered] -style @tech{variant}. The @scheme[unnumbered-part?] predicate -recognizes a @scheme[part] with the @scheme['unnumbered] variant.} +@tech{style property}. The @scheme[unnumbered-part?] predicate +recognizes a @scheme[part] with the @scheme['unnumbered] property.} @defproc[(make-paragraph [content list?]) paragraph?]{ @@ -135,9 +135,9 @@ to the current one. The @scheme[styled-paragraph?] predicate and )]{ @compat[] Like @scheme[make-paragraph], but adds the -@scheme['omitable] style @tech{variant}. The +@scheme['omitable] @tech{style property}. The @scheme[omitable-paragraph?] predicate checks for a paragraph with the -variant.} +property.} @defproc[(make-table [style any/c] @@ -185,9 +185,9 @@ parsed to the current format.} @defproc[(auxiliary-table? [v any/c]) boolean?] )]{ -@compat[] Like @scheme[make-table], but adds the @scheme['aux] style -@tech{variant}. The @scheme[auxiliary-table?] predicate recognizes -tables with the @scheme['aux] variant.} +@compat[] Like @scheme[make-table], but adds the @scheme['aux] +@tech{style property}. The @scheme[auxiliary-table?] predicate recognizes +tables with the @scheme['aux] property.} @defproc[(make-compound-paragraph [style any/c] @@ -227,20 +227,20 @@ and the result of @scheme[element-content] is always a list.} @defproc[(make-aux-element [style any/c] [content list?]) element?]{ -@compat[] Like @scheme[make-element], but adds the @scheme['aux] style -@tech{variant}.} +@compat[] Like @scheme[make-element], but adds the @scheme['aux] +@tech{style property}.} @defproc[(make-hover-element [style any/c] [content list?] [text string?]) element?]{ -@compat[] Like @scheme[make-element], but adds @scheme[hover-variant] +@compat[] Like @scheme[make-element], but adds @scheme[hover-property] containing @scheme[text] to the element's style.} @defproc[(make-script-element [style any/c] [content list?] [type string?] [script (or/c path-string? (listof string?))]) element?]{ -@compat[] Like @scheme[make-element], but adds @scheme[script-variant] +@compat[] Like @scheme[make-element], but adds @scheme[script-property] containing @scheme[type] and @scheme[script] to the element's style.} diff --git a/collects/scribblings/scribble/utils.ss b/collects/scribblings/scribble/utils.ss index b585c13454..02d7857958 100644 --- a/collects/scribblings/scribble/utils.ss +++ b/collects/scribblings/scribble/utils.ss @@ -1,7 +1,7 @@ #lang scheme/base (require scribble/core - scribble/html-variants + scribble/html-properties scribble/manual (prefix-in scheme: scribble/scheme) (prefix-in scribble: scribble/reader)) @@ -21,8 +21,8 @@ scribble/decode scribble/manual scribble/scheme - scribble/html-variants - scribble/latex-variants + scribble/html-properties + scribble/latex-properties scribble/eval scribble/bnf) @@ -155,7 +155,7 @@ (map (lambda (file strs) (let* ([file (make-element 'tt (list file ":" 'nbsp))] [file (list (make-element 'italic (list file)))]) - (list (as-flow (make-element (make-style #f (list (make-background-color-variant '(232 232 255)))) file)) + (list (as-flow (make-element (make-style #f (list (make-background-color-property '(232 232 255)))) file)) (as-flow (make-box strs))))) filenames strsm))) (make-box strs2))) diff --git a/collects/scriblib/autobib.ss b/collects/scriblib/autobib.ss index f4e201959e..3da8ba8150 100644 --- a/collects/scriblib/autobib.ss +++ b/collects/scriblib/autobib.ss @@ -2,8 +2,8 @@ (require scribble/manual scribble/core scribble/decode - scribble/html-variants - scribble/latex-variants + scribble/html-properties + scribble/latex-properties scheme/string setup/main-collects) diff --git a/collects/scriblib/figure.ss b/collects/scriblib/figure.ss index 8cbdb74ae0..fa0247622f 100644 --- a/collects/scriblib/figure.ss +++ b/collects/scriblib/figure.ss @@ -3,8 +3,8 @@ (require scribble/manual scribble/core scribble/decode - scribble/html-variants - scribble/latex-variants + scribble/html-properties + scribble/latex-properties setup/main-collects "private/counter.ss") @@ -12,7 +12,8 @@ figure* figure** Figure-target - Figure-ref) + Figure-ref + figure-ref) (define figure-style-extras (let ([abs (lambda (s) @@ -39,8 +40,8 @@ plain (list (make-element legend-style - (list* (Figure-target tag) ": " - (decode-content (list caption)))))))))))) + (list (Figure-target tag) ": " + caption)))))))))) (define (*figure style tag caption content) (make-nested-flow @@ -55,8 +56,8 @@ plain (list (make-element legend-style - (list* (Figure-target tag) ": " - (decode-content (list caption)))))))))))) + (list (Figure-target tag) ": " + caption)))))))))) (define (figure* tag caption . content) (*figure centerfiguremulti-style tag caption content)) @@ -68,3 +69,5 @@ (counter-target figures tag "Figure")) (define (Figure-ref tag) (make-element #f (list (counter-ref figures tag "Figure")))) +(define (figure-ref tag) + (make-element #f (list (counter-ref figures tag "figure")))) diff --git a/collects/scriblib/scribblings/figure.scrbl b/collects/scriblib/scribblings/figure.scrbl index 465622b85d..b3500aef6b 100644 --- a/collects/scriblib/scribblings/figure.scrbl +++ b/collects/scriblib/scribblings/figure.scrbl @@ -16,14 +16,14 @@ rendering support.} @deftogether[( -@defproc[(figure [tag string?] [caption any/c] [pre-content any/c] ...) block?] -@defproc[(figure* [tag string?] [caption any/c] [pre-content any/c] ...) block?] -@defproc[(figure** [tag string?] [caption any/c] [pre-content any/c] ...) block?] +@defproc[(figure [tag string?] [caption content?] [pre-flow pre-flow?] ...) block?] +@defproc[(figure* [tag string?] [caption content?] [pre-flow pre-flow?] ...) block?] +@defproc[(figure** [tag string?] [caption content?] [pre-flow pre-flow?] ...) block?] )]{ Creates a figure. The given @scheme[tag] is for use with -@scheme[Figure-ref]. The @scheme[caption] is an element. The -@scheme[pre-content] is decoded as a flow. +@scheme[figure-ref] or @scheme[fFgure-ref]. The @scheme[caption] is an +element. The @scheme[pre-flow] is decoded as a flow. For HTML output, the @scheme[figure*] and @scheme[figure*] functions center the figure content, while @scheme[figure**] allows the content @@ -32,12 +32,18 @@ to be wider than the document body. For two-column latex output, @scheme[figure*] and @scheme[figure**] generate a figure that spans columns.} -@defproc[(Figure-target [tag string?]) element?]{ -Generates a new figure label---normally not used directly, since it is -used by @scheme[figure].} +@defproc[(figure-ref [tag string?]) element?]{ + +Generates a reference to a figure, using a lowercase word ``figure''.} + @defproc[(Figure-ref [tag string?]) element?]{ -Generates a reference to a figure.} +Generates a reference to a figure, capitalizing the word ``Figure''.} + +@defproc[(Figure-target [tag string?]) element?]{ + +Generates a new figure label. This function is normally not used +directly, since it is used by @scheme[figure].} diff --git a/collects/setup/scribble.ss b/collects/setup/scribble.ss index 2d0a1a8cae..5b4ab3cac5 100644 --- a/collects/setup/scribble.ss +++ b/collects/setup/scribble.ss @@ -13,7 +13,7 @@ syntax/modread scribble/base-render scribble/core - scribble/html-variants + scribble/html-properties scribble/manual ; really shouldn't be here... see dynamic-require-doc scribble/private/run-pdflatex (prefix-in html: scribble/html-render) @@ -330,7 +330,7 @@ tag-prefix tags (part-title-content v) - (let* ([v (style-variants style)] + (let* ([v (style-properties style)] [v (if (ormap body-id? v) v (cons (make-body-id "doc-plt-scheme-org") diff --git a/src/mzscheme/src/schvers.h b/src/mzscheme/src/schvers.h index 2efdbbc561..170fa9715a 100644 --- a/src/mzscheme/src/schvers.h +++ b/src/mzscheme/src/schvers.h @@ -13,12 +13,12 @@ consistently.) */ -#define MZSCHEME_VERSION "4.2.1.2" +#define MZSCHEME_VERSION "4.2.1.3" #define MZSCHEME_VERSION_X 4 #define MZSCHEME_VERSION_Y 2 #define MZSCHEME_VERSION_Z 1 -#define MZSCHEME_VERSION_W 2 +#define MZSCHEME_VERSION_W 3 #define MZSCHEME_VERSION_MAJOR ((MZSCHEME_VERSION_X * 100) + MZSCHEME_VERSION_Y) #define MZSCHEME_VERSION_MINOR ((MZSCHEME_VERSION_Z * 1000) + MZSCHEME_VERSION_W)