From bf8039fc9060d1a6f18b64694fb6259c6b473b96 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 16 Jul 2010 03:37:37 -0600 Subject: [PATCH 01/54] fix relative URLs in single-page Scribble HTML output Merge to v5.0.1 (cherry picked from commit 8cb0b6fd7bf45324d668eef8101cc42437e58c3c) original commit: 4be160043c0baa717d815678dc1fd74918a5c17c --- collects/scribble/html-render.rkt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/collects/scribble/html-render.rkt b/collects/scribble/html-render.rkt index 2e7eac9f..d5b0e252 100644 --- a/collects/scribble/html-render.rkt +++ b/collects/scribble/html-render.rkt @@ -358,8 +358,10 @@ (define/private (dest->url dest) (format "~a~a~a" - (from-root (relative->path (dest-path dest)) - (get-dest-directory)) + (let ([p (relative->path (dest-path dest))]) + (if (equal? p (current-output-file)) + "" + (from-root p (get-dest-directory)))) (if (dest-page? dest) "" "#") (if (dest-page? dest) "" From 4e53ca8b78caedd3d4d981c14c5b682ba2385234 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 20 Jul 2010 09:33:15 -0600 Subject: [PATCH 02/54] fix uses of `scheme' in the Scribble style guide Closes PR 10999 Merge to 5.0.1 (cherry picked from commit 4bd97ae80e23c8bed00c18c131d621592866f67d) original commit: 2c75fe25a9f5885fd1a1ba884869307dc5c672e3 --- collects/scribblings/scribble/style.scrbl | 76 +++++++++++------------ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/collects/scribblings/scribble/style.scrbl b/collects/scribblings/scribble/style.scrbl index 1590a2c4..ad34b399 100644 --- a/collects/scribblings/scribble/style.scrbl +++ b/collects/scribblings/scribble/style.scrbl @@ -8,7 +8,7 @@ @section{Prose and Terminology} -In the descriptive body of @scheme[defform], @scheme[defproc], etc., +In the descriptive body of @racket[defform], @racket[defproc], etc., do not start with ``This ...'' Instead, start with a sentence whose implicit subject is the form or value being described. Capitalize the first word. Thus, the description will often start with ``Returns'' or @@ -18,7 +18,7 @@ Do not use the word ``argument'' to describe a sub-form in a syntactic form; use the term ``sub-form'' instead, reserving ``argument'' for values or expressions in a function call. Refer to libraries and languages as such, rather than as ``modules'' (even though the form to -typeset a library or language name is called @scheme[schememodname]). +typeset a library or language name is called @racket[racketmodname]). Do not call an identifier (i.e., a syntactic element) a ``variable'' or a ``symbol.'' Do not use the word ``expression'' for a form that is a definition or might be a definition; use the word ``form,'' instead. @@ -26,59 +26,59 @@ Prefer ``function'' to ``procedure.'' Avoid cut-and-paste for descriptive text. If two functions are similar, consider documenting them together with -@scheme[deftogether]. To abstract a description, consider using -explicit prose abstraction, such as ``@scheme[x] is like @scheme[y], +@racket[deftogether]. To abstract a description, consider using +explicit prose abstraction, such as ``@racket[x] is like @racket[y], except that ...,'' instead of abstracting the source and instantiating it multiple times; often, a prose abstraction is clearer to the reader than a hidden abstraction in the document implementation. @section{Typesetting Code} -Use @schemeidfont{id} or a name that ends @schemeidfont{-id} in -@scheme[defform] to mean an identifier, not @schemeidfont{identifier}, -@schemeidfont{variable}, @schemeidfont{name}, or -@schemeidfont{symbol}. Similarly, use @schemeidfont{expr} or something -that ends @schemeidfont{-expr} for an expression position within a -syntactic form. Use @schemeidfont{body} for a form (definition or +Use @racketidfont{id} or a name that ends @racketidfont{-id} in +@racket[defform] to mean an identifier, not @racketidfont{identifier}, +@racketidfont{variable}, @racketidfont{name}, or +@racketidfont{symbol}. Similarly, use @racketidfont{expr} or something +that ends @racketidfont{-expr} for an expression position within a +syntactic form. Use @racketidfont{body} for a form (definition or expression) in an internal-definition position. Do not use -@schemeidfont{expr} for something that isn't exactly an expression, -@scheme[id] for something that isn't exactly an identifier, etc.; -instead, use @scheme[defform/subs] to define a new non-terminal. +@racketidfont{expr} for something that isn't exactly an expression, +@racket[id] for something that isn't exactly an identifier, etc.; +instead, use @racket[defform/subs] to define a new non-terminal. -Beware of using @scheme[deftogether] to define multiple variants of a -syntactic form or procedure, because each @scheme[defform] or -@scheme[defproc] creates a definition point, but each form or +Beware of using @racket[deftogether] to define multiple variants of a +syntactic form or procedure, because each @racket[defform] or +@racket[defproc] creates a definition point, but each form or procedure should have a single definition point. (Scribble issues a warning when a binding has multiple definition points.) Instead, use -@scheme[defproc*] or @scheme[defform*]. +@racket[defproc*] or @racket[defform*]. Pay attention to the difference between identifiers and meta-variables -when using @scheme[scheme], especially outside of @scheme[defproc] or -@scheme[defform]. Prefix a meta-variable with @litchar{_}; for +when using @racket[racket], especially outside of @racket[defproc] or +@racket[defform]. Prefix a meta-variable with @litchar{_}; for example, -@verbatim[#:indent 2]|{@scheme[(rator-expr rand-expr ...)]}| +@verbatim[#:indent 2]|{@racket[(rator-expr rand-expr ...)]}| would be the wrong way to refer to the grammar of a function call, -because it produces @scheme[(rator-expr rand-expr ...)], where -@schemeidfont{rator-expr} and @schemeidfont{rand-expr} are +because it produces @racket[(rator-expr rand-expr ...)], where +@racketidfont{rator-expr} and @racketidfont{rand-expr} are typeset as variables. The correct description is -@verbatim[#:indent 2]|{@scheme[(_rator-expr _rand-expr ...)]}| +@verbatim[#:indent 2]|{@racket[(_rator-expr _rand-expr ...)]}| -which produces @scheme[(_rator-expr _rand-expr ...)], where -@schemeidfont{rator-expr} and @schemeidfont{rand-expr} are typeset as -meta-variables. The @scheme[defproc], @scheme[defform], @|etc| forms +which produces @racket[(_rator-expr _rand-expr ...)], where +@racketidfont{rator-expr} and @racketidfont{rand-expr} are typeset as +meta-variables. The @racket[defproc], @racket[defform], @|etc| forms greatly reduce this burden in descriptions, since they automatically set up meta-variable typesetting for non-literal identifiers. In -@scheme[defform], be sure to include literal identifiers (i.e., those +@racket[defform], be sure to include literal identifiers (i.e., those not meant as variables, other than the form name being defined) in a -@scheme[#:literals] clause. +@racket[#:literals] clause. To typeset an identifier with no particular interpretation---syntax, -variable, meta-variable, etc.---use @scheme[schemeidfont] (e.g., as in -@schemeidfont{rand-expr} above). Otherwise, use @scheme[litchar], -not merely @scheme[schemefont] or @scheme[verbatim], to refer to a +variable, meta-variable, etc.---use @racket[racketidfont] (e.g., as in +@racketidfont{rand-expr} above). Otherwise, use @racket[litchar], +not merely @racket[racketfont] or @racket[verbatim], to refer to a specific sequence of characters. When showing example evaluations, use the REPL-snapshot style: @@ -89,7 +89,7 @@ When showing example evaluations, use the REPL-snapshot style: ] }| -See also the @scheme[scribble/eval] library. +See also the @racket[scribble/eval] library. Use four dots, @litchar{....}, in place of omitted code, since @litchar{...} means repetition. @@ -112,12 +112,12 @@ at the end of quotation marks (i.e., a sentence-terminating period goes inside the quotation marks). Of course, this rule does not apply for quotation marks that are part of code. -Do not use a citation reference (as created by @scheme[cite]) as a +Do not use a citation reference (as created by @racket[cite]) as a noun; use it as an annotation. -Do not start a sentence with a Scheme variable name, since it is -normally lowercase. For example, use ``The @scheme[_thing] argument -is...'' instead of ``@scheme[_thing] is...'' +Do not start a sentence with a Racket variable name, since it is +normally lowercase. For example, use ``The @racket[_thing] argument +is...'' instead of ``@racket[_thing] is...'' @section{Section Titles} @@ -126,7 +126,7 @@ prepositions, and conjunctions that are not at the start of the title. A manual title should normally start with a suitable keyword or key phrase (such as ``Scribble'' for this manual) that is in boldface. If -the key word is primarily an executable name, use @scheme[exec] -instead of @scheme[bold]. Optionally add further descriptive text in +the key word is primarily an executable name, use @racket[exec] +instead of @racket[bold]. Optionally add further descriptive text in the title after a colon, where the text starting with the colon is not in boldface. From 1351dda10f532858c70be1317c7eeb551c3bc75b Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 20 Jul 2010 10:00:57 -0600 Subject: [PATCH 03/54] fix doc typo Closes PR 10917 Merge to 5.0.1 (cherry picked from commit 8dfe2a6a917612a509486ee68cf9f2eedd3af4b7) original commit: 6af6bd5898125cc6ab2029244fab32ebc750388a --- collects/scribblings/scribble/core.scrbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/scribblings/scribble/core.scrbl b/collects/scribblings/scribble/core.scrbl index 69ecbbec..bf9b3aec 100644 --- a/collects/scribblings/scribble/core.scrbl +++ b/collects/scribblings/scribble/core.scrbl @@ -524,7 +524,7 @@ The following @tech{style properties} are currently recognized: @defstruct[nested-flow ([style any/c] - [paragraphs (listof block?)])]{ + [blocks (listof block?)])]{ A @techlink{nested flow} has a style and a @tech{flow}. From df74bf0d30fe36cc96fc0bbf16a93f9f699fdf2f Mon Sep 17 00:00:00 2001 From: Kevin Tew Date: Tue, 6 Jul 2010 16:27:12 -0600 Subject: [PATCH 04/54] Parallel docs build original commit: 5bb2e148de87457ebb4790287d3b83b872c91a78 --- collects/scribble/base-render.rkt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/scribble/base-render.rkt b/collects/scribble/base-render.rkt index 47682e9b..7de7a0b3 100644 --- a/collects/scribble/base-render.rkt +++ b/collects/scribble/base-render.rkt @@ -207,7 +207,7 @@ ;; marshal info (define/public (get-serialize-version) - 2) + 3) (define/public (serialize-info ri) (parameterize ([current-serialize-resolve-info ri]) From b665360e577c9e654d3186ae388c48b22cb62e53 Mon Sep 17 00:00:00 2001 From: Kevin Tew Date: Sat, 24 Jul 2010 17:21:21 -0600 Subject: [PATCH 05/54] Fix cross references original commit: 81c4275220e6d8eee2d4769353aba748b7d8d0a6 --- collects/scribble/base-render.rkt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/scribble/base-render.rkt b/collects/scribble/base-render.rkt index 7de7a0b3..2a5cace6 100644 --- a/collects/scribble/base-render.rkt +++ b/collects/scribble/base-render.rkt @@ -207,7 +207,7 @@ ;; marshal info (define/public (get-serialize-version) - 3) + 4) (define/public (serialize-info ri) (parameterize ([current-serialize-resolve-info ri]) From 2b9bb591e63e1a331787ee71577c1c9421250c61 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 25 Jul 2010 10:51:19 -0500 Subject: [PATCH 06/54] add collection-file-path and splace collection trees at the file level original commit: 5f1aa418f30f4df086c85ed18dfc5395468b1638 --- collects/scribble/jfp.rkt | 2 +- collects/scribble/sigplan.rkt | 2 +- collects/scriblib/autobib.rkt | 2 +- collects/scriblib/figure.rkt | 3 ++- collects/scriblib/footnote.rkt | 4 +++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/collects/scribble/jfp.rkt b/collects/scribble/jfp.rkt index 7db49c74..e79f7713 100644 --- a/collects/scribble/jfp.rkt +++ b/collects/scribble/jfp.rkt @@ -14,7 +14,7 @@ (define jfp-extras (let ([abs (lambda (s) (path->main-collects-relative - (build-path (collection-path "scribble") "jfp" s)))]) + (collection-file-path s "scribble" "jfp")))]) (list (make-css-addition (abs "jfp.css")) (make-tex-addition (abs "jfp.tex"))))) diff --git a/collects/scribble/sigplan.rkt b/collects/scribble/sigplan.rkt index 41fcf979..8eab37c5 100644 --- a/collects/scribble/sigplan.rkt +++ b/collects/scribble/sigplan.rkt @@ -50,7 +50,7 @@ (define sigplan-extras (let ([abs (lambda (s) (path->main-collects-relative - (build-path (collection-path "scribble") "sigplan" s)))]) + (collection-file-path s "scribble" "sigplan")))]) (list (make-css-addition (abs "sigplan.css")) (make-tex-addition (abs "sigplan.tex"))))) diff --git a/collects/scriblib/autobib.rkt b/collects/scriblib/autobib.rkt index 24810e10..649ec643 100644 --- a/collects/scriblib/autobib.rkt +++ b/collects/scriblib/autobib.rkt @@ -16,7 +16,7 @@ (define autobib-style-extras (let ([abs (lambda (s) (path->main-collects-relative - (build-path (collection-path "scriblib") s)))]) + (collection-file-path s "scriblib")))]) (list (make-css-addition (abs "autobib.css")) (make-tex-addition (abs "autobib.tex"))))) diff --git a/collects/scriblib/figure.rkt b/collects/scriblib/figure.rkt index fa024762..80e8ca58 100644 --- a/collects/scriblib/figure.rkt +++ b/collects/scriblib/figure.rkt @@ -17,7 +17,8 @@ (define figure-style-extras (let ([abs (lambda (s) - (build-path (collection-path "scriblib") s))]) + (path->main-collects-relative + (collection-file-path s "scriblib")))]) (list (make-css-addition (abs "figure.css")) (make-tex-addition (abs "figure.tex"))))) diff --git a/collects/scriblib/footnote.rkt b/collects/scriblib/footnote.rkt index 0ed1403f..cc3957b5 100644 --- a/collects/scriblib/footnote.rkt +++ b/collects/scriblib/footnote.rkt @@ -5,6 +5,7 @@ scribble/html-properties scribble/latex-properties racket/promise + setup/main-collects "private/counter.ss") (provide note @@ -12,7 +13,8 @@ (define footnote-style-extras (let ([abs (lambda (s) - (build-path (collection-path "scriblib") s))]) + (path->main-collects-relative + (collection-file-path s "scriblib")))]) (list (make-css-addition (abs "footnote.css")) (make-tex-addition (abs "footnote.tex"))))) From 9ed7cf89ead366382705bd585cc905f0ac6a7ed5 Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Mon, 26 Jul 2010 11:43:04 -0400 Subject: [PATCH 07/54] Add @nocopyright option to scribble/sigplan. original commit: dba04c8aea07466a9459fd55fd55290e1179ac6a --- collects/scribble/sigplan.rkt | 18 +++++++-------- collects/scribble/sigplan/lang.rkt | 25 ++++++++++++--------- collects/scribblings/scribble/sigplan.scrbl | 12 +++++++++- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/collects/scribble/sigplan.rkt b/collects/scribble/sigplan.rkt index 8eab37c5..e6e5bcc8 100644 --- a/collects/scribble/sigplan.rkt +++ b/collects/scribble/sigplan.rkt @@ -35,17 +35,17 @@ (->* () () #:rest (listof pre-content?) content?)]) -(provide preprint 10pt +(provide preprint 10pt nocopyright include-abstract) -(define-syntax (preprint stx) - (raise-syntax-error #f - "option must appear on the same line as `#lang scribble/sigplan'" - stx)) -(define-syntax (10pt stx) - (raise-syntax-error #f - "option must appear on the same line as `#lang scribble/sigplan'" - stx)) +(define-syntax-rule (defopts name ...) + (begin (define-syntax (name stx) + (raise-syntax-error #f + "option must appear on the same line as `#lang scribble/sigplan'" + stx)) + ... + (provide name ...))) +(defopts preprint 10pt nocopyright) (define sigplan-extras (let ([abs (lambda (s) diff --git a/collects/scribble/sigplan/lang.rkt b/collects/scribble/sigplan/lang.rkt index 39ddf14f..f2aa6ef0 100644 --- a/collects/scribble/sigplan/lang.rkt +++ b/collects/scribble/sigplan/lang.rkt @@ -4,6 +4,7 @@ scribble/base scribble/decode scribble/sigplan + racket/list "../private/defaults.ss" (for-syntax scheme/base)) (provide (except-out (all-from-out scribble/doclang) #%module-begin) @@ -15,30 +16,32 @@ (syntax-case stx () [(_ id . body) (let ([preprint? #f] - [10pt? #f]) + [10pt? #f] + [nocopyright? #f]) (let loop ([stuff #'body]) - (syntax-case* stuff (preprint 10pt) (lambda (a b) (eq? (syntax-e a) (syntax-e b))) + (syntax-case* stuff (preprint 10pt nocopyright) (lambda (a b) (eq? (syntax-e a) (syntax-e b))) [(ws . body) ;; Skip intraline whitespace to find options: (and (string? (syntax-e #'ws)) (regexp-match? #rx"^ *$" (syntax-e #'ws))) (loop #'body)] [(preprint . body) - (set! preprint? #t) + (set! preprint? "preprint") + (loop #'body)] + [(nocopyright . body) + (set! nocopyright? "nocopyrightspace") (loop #'body)] [(10pt . body) - (set! 10pt? #t) + (set! 10pt? "10pt") (loop #'body)] [body - #`(#%module-begin id (post-process #,preprint? #,10pt?) () . body)])))])) + #`(#%module-begin id (post-process #,preprint? #,10pt? #,nocopyright?) () . body)])))])) -(define ((post-process preprint? 10pt?) doc) +(define ((post-process . opts) doc) (let ([options - (cond - [(and preprint? 10pt?) "[preprint, 10pt]"] - [preprint? "[preprint]"] - [10pt? "[10pt]"] - [else ""])]) + (if (ormap values opts) + (format "[~a]" (apply string-append (add-between (filter values opts) ", "))) + "")]) (add-sigplan-styles (add-defaults doc (string->bytes/utf-8 diff --git a/collects/scribblings/scribble/sigplan.scrbl b/collects/scribblings/scribble/sigplan.scrbl index 90eaf36b..2b4f14e8 100644 --- a/collects/scribblings/scribble/sigplan.scrbl +++ b/collects/scribblings/scribble/sigplan.scrbl @@ -29,7 +29,17 @@ same line as @hash-lang[], with only whitespace between #lang scribble/sigplan @10pt }| -The @racket[10pt] and @racket[preprint] options can be +@defidform[nocopyright]{ + +Enables the @tt{nocopyright} option. Use @racket[nocopyright] only on the +same line as @hash-lang[], with only whitespace between +@racketmodname[scribble/sigplan] and @racket[nocopyright]: + +@verbatim[#:indent 2]|{ + #lang scribble/sigplan @nocopyright +}|} + +The @racket[10pt], @racket[preprint], and @racket[nocopyright] options can be used together and may appear in any order. } From 9cee9100aa6320e5104153105f21466a8a044b1a Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 29 Jul 2010 06:56:05 -0500 Subject: [PATCH 08/54] add example to scribble/bnf docs original commit: 33e3dac94eaa7cf66be90090d2ff0684950fcd6a --- collects/scribblings/scribble/bnf.scrbl | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/collects/scribblings/scribble/bnf.scrbl b/collects/scribblings/scribble/bnf.scrbl index 46509979..84aa60d8 100644 --- a/collects/scribblings/scribble/bnf.scrbl +++ b/collects/scribblings/scribble/bnf.scrbl @@ -1,6 +1,7 @@ #lang scribble/doc @(require scribble/manual "utils.ss" + scribble/bnf (for-label scribble/bnf)) @title[#:tag "bnf"]{BNF Grammars} @@ -8,6 +9,40 @@ @defmodule[scribble/bnf]{The @racket[scribble/bnf] library provides utilities for typesetting grammars.} +For example, + +@verbatim[#:indent 2]|{ +@(let ([open @litchar{(}] + [close @litchar{)}]) + @BNF[(list @nonterm{expr} + @nonterm{id} + @BNF-seq[open @kleeneplus[@nonterm{expr}] close] + @BNF-seq[open @litchar{lambda} + open @kleenestar[@nonterm{id}] close + @nonterm{expr} close] + @nonterm{val}) + (list @nonterm{val} + @BNF-alt[@nonterm{number} @nonterm{primop}]) + (list @nonterm{id} + @elem{any name except for @litchar{lambda}})]) +}| + +produces the output + +@(let ([open @litchar{(}] + [close @litchar{)}]) + @BNF[(list @nonterm{expr} + @nonterm{id} + @BNF-seq[open @kleeneplus[@nonterm{expr}] close] + @BNF-seq[open @litchar{lambda} + open @kleenestar[@nonterm{id}] close + @nonterm{expr} close] + @nonterm{val}) + (list @nonterm{val} + @BNF-alt[@nonterm{number} @nonterm{primop}]) + (list @nonterm{id} + @elem{any name except for @litchar{lambda}})]) + See also @racket[racketgrammar]. @defproc[(BNF [prod (cons element? (listof element?))] ...) table?]{ From 8bfe8dddfa5eff5753409d4bad1b2beec750fc48 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sat, 31 Jul 2010 09:40:04 -0500 Subject: [PATCH 09/54] improved contract original commit: f96ed0632a1b4536ce6bf16df42ae1251cd9e50c --- collects/scribble/base.rkt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/scribble/base.rkt b/collects/scribble/base.rkt index 292d9840..0aed8345 100644 --- a/collects/scribble/base.rkt +++ b/collects/scribble/base.rkt @@ -285,7 +285,7 @@ [image (->* ((or/c path-string? (cons/c 'collects (listof bytes?)))) (#:scale real? - #:suffixes (listof #rx"^[.]")) + #:suffixes (listof (and/c string? #rx"^[.]"))) #:rest (listof content?) image-element?)]) From 0e875d96bbc04dac79cbb8da25ed9391fed1c0c5 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 3 Aug 2010 12:48:03 -0600 Subject: [PATCH 10/54] add optional `#:key' argument to `tech' and `techlink' to specify the defined technical term separate from the link content original commit: 656321dbcb6dd1032fff5dc2ba49ef65ec4a0bfb --- collects/scribble/private/manual-tech.rkt | 24 +++++++++------ collects/scribblings/scribble/manual.scrbl | 34 ++++++++++++---------- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/collects/scribble/private/manual-tech.rkt b/collects/scribble/private/manual-tech.rkt index 539b7313..3e4d92ca 100644 --- a/collects/scribble/private/manual-tech.rkt +++ b/collects/scribble/private/manual-tech.rkt @@ -8,12 +8,18 @@ (provide/contract [deftech (() (#:style? boolean?) #:rest (listof pre-content?) . ->* . element?)] - [tech (() (#:doc (or/c module-path? false/c) #:tag-prefixes (or/c (listof string?) false/c)) #:rest (listof pre-content?) . ->* . element?)] - [techlink (() (#:doc (or/c module-path? false/c) #:tag-prefixes (or/c (listof string?) false/c)) #:rest (listof pre-content?) . ->* . element?)]) + [tech (() + (#:doc (or/c module-path? false/c) #:tag-prefixes (or/c (listof string?) false/c) #:key (or/c string? #f)) + #:rest (listof pre-content?) + . ->* . element?)] + [techlink (() + (#:doc (or/c module-path? false/c) #:tag-prefixes (or/c (listof string?) false/c) #:key (or/c string? #f)) + #:rest (listof pre-content?) + . ->* . element?)]) -(define (*tech make-elem style doc prefix s) +(define (*tech make-elem style doc prefix s key) (let* ([c (decode-content s)] - [s (string-foldcase (content->string c))] + [s (string-foldcase (or key (content->string c)))] [s (regexp-replace #rx"ies$" s "y")] [s (regexp-replace #rx"s$" s "")] [s (regexp-replace* #px"[-\\s]+" s " ")]) @@ -23,7 +29,7 @@ (let* ([e (if style? (apply defterm s) (make-element #f (decode-content s)))] - [t (*tech make-target-element #f #f #f (list e))]) + [t (*tech make-target-element #f #f #f (list e) #f)]) (make-index-element #f (list t) (target-element-tag t) @@ -31,14 +37,14 @@ (list e) 'tech))) -(define (tech #:doc [doc #f] #:tag-prefixes [prefix #f] . s) +(define (tech #:doc [doc #f] #:tag-prefixes [prefix #f] #:key [key #f] . s) (*tech (lambda (style c tag) (make-link-element style (list (make-element "techinside" c)) tag)) "techoutside" - doc prefix s)) + doc prefix s key)) -(define (techlink #:doc [doc #f] #:tag-prefixes [prefix #f] . s) - (*tech make-link-element #f doc prefix s)) +(define (techlink #:doc [doc #f] #:tag-prefixes [prefix #f] #:key [key #f] . s) + (*tech make-link-element #f doc prefix s key)) diff --git a/collects/scribblings/scribble/manual.scrbl b/collects/scribblings/scribble/manual.scrbl index 88d5db44..ad635fe3 100644 --- a/collects/scribblings/scribble/manual.scrbl +++ b/collects/scribblings/scribble/manual.scrbl @@ -1022,16 +1022,19 @@ If @racket[style?] is true, then @racket[defterm] is used on @racket[pre-content].} @defproc[(tech [pre-content pre-content?] ... - [#:doc module-path (or/c module-path? false/c) #f] - [#:tag-prefixes prefixes (or/c (listof string?) false/c) #f]) + [#:key key (or/c string? #f) #f] + [#:doc module-path (or/c module-path? #f) #f] + [#:tag-prefixes prefixes (or/c (listof string?) #f) #f]) element?]{ Produces an element for the @tech{decode}d @racket[pre-content], and -hyperlinks it to the definition of the content as established by -@racket[deftech]. The content's string form is normalized in the same -way as for @racket[deftech]. The @racket[#:doc] and -@racket[#:tag-prefixes] arguments support cross-document and -section-specific references, like in @racket[secref]. +hyperlinks it to the definition of the key as established by +@racket[deftech]. If @racket[key] is false, the decoded content is +converted to a string (using @racket[content->string]) to use as a +key; in either case, the key is normalized in the same way as for +@racket[deftech]. The @racket[#:doc] and @racket[#:tag-prefixes] +arguments support cross-document and section-specific references, like +in @racket[secref]. With the default style files, the hyperlink created by @racket[tech] is somewhat quieter than most hyperlinks: the underline in HTML output @@ -1045,11 +1048,12 @@ defined, but a sentence uses the term ``binding,'' the latter can be linked to the former using @racketfont["@tech{bind}ing"].} @defproc[(techlink [pre-content pre-content?] ... - [#:doc module-path (or/c module-path? false/c) #f] - [#:tag-prefixes prefixes (or/c (listof string?) false/c) #f]) + [#:key key (or/c string? #f) #f] + [#:doc module-path (or/c module-path? #f) #f] + [#:tag-prefixes prefixes (or/c (listof string?) #f) #f]) element?]{ -Like @racket[tech], but the link is not a quiet. For example, in HTML +Like @racket[tech], but the link is not quiet. For example, in HTML output, a hyperlink underline appears even when the mouse is not over the link.} @@ -1122,12 +1126,12 @@ which is created with @racket[bib-entry]. The entries are typeset in order as given.} @defproc[(bib-entry [#:key key string?] - [#:title title (or/c false/c pre-content?)] + [#:title title (or/c #f pre-content?)] [#:is-book? is-book? boolean? #f] - [#:author author (or/c false/c pre-content?) #f] - [#:location location (or/c false/c pre-content?) #f] - [#:date date (or/c false/c pre-content?) #f] - [#:url url (or/c false/c pre-content?) #f]) + [#:author author (or/c #f pre-content?) #f] + [#:location location (or/c #f pre-content?) #f] + [#:date date (or/c #f pre-content?) #f] + [#:url url (or/c #f pre-content?) #f]) bib-entry?]{ Creates a bibliography entry. The @racket[key] is used to refer to the From d6bbf9dfe5dfff6218138a9c0994e38d59ad671b Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 17 Aug 2010 17:32:22 -0600 Subject: [PATCH 11/54] adjust Scribble to sync filename case with uses original commit: d97ee688676ca70a7714d09fadb681ad717ffe3b --- collects/scribble/html-render.rkt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/collects/scribble/html-render.rkt b/collects/scribble/html-render.rkt index d5b0e252..58483b1e 100644 --- a/collects/scribble/html-render.rkt +++ b/collects/scribble/html-render.rkt @@ -1421,7 +1421,12 @@ [full-path (build-path (path-only (current-output-file)) filename)]) (parameterize ([on-separate-page-ok #f]) - (with-output-to-file full-path #:exists 'truncate/replace + ;; We use 'replace instead of the usual 'truncate/replace + ;; to avoid problems where a filename changes only in case, + ;; in which case some platforms will see the old file + ;; as matching the new name, while others don't. Replacing + ;; the file syncs the case with the current uses. + (with-output-to-file full-path #:exists 'replace (lambda () (render-one-part d ri full-path number))) null)) (parameterize ([on-separate-page-ok #t]) From 6a51476ecddb23fcb5ef03f8bcd07d38cbf4fc19 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 17 Aug 2010 17:42:11 -0600 Subject: [PATCH 12/54] doc clarification original commit: 4945851df67386945bd1049e1b276b3459354a8c --- collects/scribblings/scribble/base.scrbl | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/collects/scribblings/scribble/base.scrbl b/collects/scribblings/scribble/base.scrbl index 2bd94469..3a1fde8f 100644 --- a/collects/scribblings/scribble/base.scrbl +++ b/collects/scribblings/scribble/base.scrbl @@ -233,12 +233,13 @@ beginning of each line. The @racket[str]s are @emph{not} decoded with @racket[decode-content], so @racket[(verbatim "---")] renders with three hyphens instead of an -em-dash. Beware, however, that @litchar["@"] for a @racket[verbatim] -call performs some processing before delivering arguments to -@racket[verbatim]. The @racket[verbatim] form is typically used with -@litchar["|{"]...@litchar["}|"] or similar brackets to disable -@litchar["@"] notation within the @racket[verbatim] argument, like -this: +em-dash. Beware, however, that @emph{reading} +@litchar["@"]@racket[verbatim] converts @litchar["@"] syntax +within the argument, and such reading occurs well before +arguments to @racket[verbatim] are delivered at run-time. To disable simple +@litchar["@"] notation within the @racket[verbatim] argument, +@racket[verbatim] is typically used with +@litchar["|{"]...@litchar["}|"] or similar brackets, like this: @verbatim[#:indent 2]|{ @verbatim|{ @@ -253,8 +254,8 @@ which renders as }| Even with @litchar["|{"]...@litchar["}|"], beware that consistent -leading whitespace is removed; see @secref["alt-body-syntax"] for more -information. +leading whitespace is removed by the parser; see +@secref["alt-body-syntax"] for more information. See also @racket[literal].} From 6e73866b6f7dbdbf5892feeac521f2022e866ec4 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sat, 21 Aug 2010 15:07:43 -0500 Subject: [PATCH 13/54] improved the image docs slightly original commit: 46e9a3b79be1f775c883567df43b0291d2cffc98 --- collects/scribblings/scribble/base.scrbl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/collects/scribblings/scribble/base.scrbl b/collects/scribblings/scribble/base.scrbl index 3a1fde8f..59586d52 100644 --- a/collects/scribblings/scribble/base.scrbl +++ b/collects/scribblings/scribble/base.scrbl @@ -334,14 +334,18 @@ See also @racket[verbatim].} @exec{setup-plt} and @exec{scribble} to the directory of the main document file. The @racket[path] argument also can be a result of @racket[path->main-collects-relative]. - + The strings in @racket[suffixes] are filtered to those supported by given renderer, and then the acceptable suffixes are tried in order. The HTML renderer supports @racket[".png"] and @racket[".gif"], while the Latex renderer supports @racket[".png"], @racket[".pdf"], and @racket[".ps"] (but @racket[".ps"] works only when converting Latex output to DVI, and @racket[".png"] and - @racket[".pdf"] work only for converting Latex output to PDF).} + @racket[".pdf"] work only for converting Latex output to PDF). + + Note that when the @racket[suffixes] library is non-empty, then + the @racket[path] argument should not have a suffix. + } @; ------------------------------------------------------------------------ From 7857dca4585b5f597b5041090a62df0d766b0a0f Mon Sep 17 00:00:00 2001 From: Jon Rafkind Date: Mon, 23 Aug 2010 15:13:00 -0600 Subject: [PATCH 14/54] move purpose statements to the info files original commit: 65c245cdc79e8f515c55c261dacb663fbf022acf --- collects/scribble/info.rkt | 1 + collects/scriblib/info.rkt | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 collects/scriblib/info.rkt diff --git a/collects/scribble/info.rkt b/collects/scribble/info.rkt index 5d0130f0..d7c2e67a 100644 --- a/collects/scribble/info.rkt +++ b/collects/scribble/info.rkt @@ -7,3 +7,4 @@ (define raco-commands '(("scribble" scribble/run "render a Scribble document" #f))) +(define purpose "This collect contains the implementation of scribble.") diff --git a/collects/scriblib/info.rkt b/collects/scriblib/info.rkt new file mode 100644 index 00000000..69062dd5 --- /dev/null +++ b/collects/scriblib/info.rkt @@ -0,0 +1,3 @@ +#lang setup/infotab + +(define purpose "This collect contains auxiliary scribble libraries, they have their own documentation linked from the top level.") From 49e5d4f640d5b853047a4082a0c62f768ddcae81 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 24 Aug 2010 06:05:29 -0600 Subject: [PATCH 15/54] fix Scribble `racket' rendering of quotes which used to trigger too much space after a quoted form original commit: 31f6a0da4ee3239706c80f0082a81e7b44ae7e28 --- collects/scribble/racket.rkt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/collects/scribble/racket.rkt b/collects/scribble/racket.rkt index 9c2be06c..a132ac47 100644 --- a/collects/scribble/racket.rkt +++ b/collects/scribble/racket.rkt @@ -1088,8 +1088,7 @@ (list (do-syntax-ize (car v) col line ht #f qq #f) c) (vector #f line col (+ 1 col) - (+ 1 - (if (and qq (zero? qq)) 1 0) + (+ delta (syntax-span c))))))] [(or (list? v) (vector? v) From d9f0de4582f7292d8dae03d96aaeea474c730c91 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 24 Aug 2010 07:19:15 -0600 Subject: [PATCH 16/54] fix rendering of constructor style struct value's first field original commit: 0b71f65ba931d0d9c316a4e09c5b6b26f074bb3d --- collects/scribble/racket.rkt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/collects/scribble/racket.rkt b/collects/scribble/racket.rkt index a132ac47..8029f4eb 100644 --- a/collects/scribble/racket.rkt +++ b/collects/scribble/racket.rkt @@ -604,7 +604,10 @@ [(mpair? (syntax-e c)) (syntax-e c)] [else c])] - [first-expr? (and expr? (not (struct-proxy? (syntax-e c))) (not no-cons?))] + [first-expr? (and expr? + (or (zero? quote-depth) + (not (struct-proxy? (syntax-e c)))) + (not no-cons?))] [dotted? #f]) (cond [(and (syntax? l) @@ -1114,10 +1117,10 @@ [else 0])] [delta (if (and qq (zero? qq)) (cond - [(vector? v) 8] - [(struct? v) 1] - [no-cons? 1] - [else 5]) + [(vector? v) 8] ; `(vector ' + [(struct? v) 1] ; '(' + [no-cons? 1] ; '(' + [else 6]) ; `(list ' 1)] [r (let ([l (let loop ([col (+ col delta vec-sz graph-sz)] [v (cond From 6ce47a9d1e8aba5b083c8e5832571b94d6db5106 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 24 Aug 2010 20:50:46 -0600 Subject: [PATCH 17/54] change Scribble's `interaction', etc. to use non-default `current-print' to format results, if one is installed in a sandboxed evaluator original commit: a19899898f1f7774f634ad44df560f4813fec91c --- collects/scribble/eval.rkt | 89 ++++++++++++++---------- collects/scribblings/scribble/eval.scrbl | 20 ++++-- 2 files changed, 70 insertions(+), 39 deletions(-) diff --git a/collects/scribble/eval.rkt b/collects/scribble/eval.rkt index fbc0f1dd..180fabb1 100644 --- a/collects/scribble/eval.rkt +++ b/collects/scribble/eval.rkt @@ -92,40 +92,45 @@ (make-flow (list p)))))) (format-output (cadar val-list+outputs) output-color) (format-output (caddar val-list+outputs) error-color) - (if (string? (caar val-list+outputs)) - ;; Error result case: - (map - (lambda (s) - (car (format-output s error-color))) - (filter - (lambda (s) (not (equal? s ""))) - (let sloop ([s (caar val-list+outputs)]) - (apply - append - (map (lambda (s) - (if ((string-length s) . > . maxlen) - ;; break the error message into multiple lines: - (let loop ([pos (sub1 maxlen)]) - (cond - [(zero? pos) (cons (substring s 0 maxlen) - (sloop (substring s maxlen)))] - [(char-whitespace? (string-ref s pos)) - (cons (substring s 0 pos) - (sloop (substring s (add1 pos))))] - [else (loop (sub1 pos))])) - (list s))) - (regexp-split #rx"\n" s)))))) - ;; Normal result case: - (let ([val-list (caar val-list+outputs)]) - (if (equal? val-list (list (void))) - null - (map (lambda (v) - (list (make-flow (list (make-paragraph - (list - (hspace 2) - (elem #:style result-color - (to-element/no-color v #:expr? (print-as-expression))))))))) - val-list)))) + (cond + [(string? (caar val-list+outputs)) + ;; Error result case: + (map + (lambda (s) + (car (format-output s error-color))) + (filter + (lambda (s) (not (equal? s ""))) + (let sloop ([s (caar val-list+outputs)]) + (apply + append + (map (lambda (s) + (if ((string-length s) . > . maxlen) + ;; break the error message into multiple lines: + (let loop ([pos (sub1 maxlen)]) + (cond + [(zero? pos) (cons (substring s 0 maxlen) + (sloop (substring s maxlen)))] + [(char-whitespace? (string-ref s pos)) + (cons (substring s 0 pos) + (sloop (substring s (add1 pos))))] + [else (loop (sub1 pos))])) + (list s))) + (regexp-split #rx"\n" s))))))] + [(box? (caar val-list+outputs)) + ;; Output formatted as string: + (format-output (unbox (caar val-list+outputs)) result-color)] + [else + ;; Normal result case: + (let ([val-list (caar val-list+outputs)]) + (if (equal? val-list (list (void))) + null + (map (lambda (v) + (list (make-flow (list (make-paragraph + (list + (hspace 2) + (elem #:style result-color + (to-element/no-color v #:expr? (print-as-expression))))))))) + val-list)))]) (loop (cdr expr-paras) (cdr val-list+outputs) #f))))))) @@ -159,7 +164,21 @@ (get-output ev) (get-error-output ev)))]) (list (let ([v (do-plain-eval ev s #t)]) - (make-reader-graph (copy-value v (make-hasheq)))) + (if (call-in-sandbox-context + ev + (let ([cp (current-print)]) + (lambda () + (and (eq? (current-print) cp) + (print-as-expression))))) + (make-reader-graph (copy-value v (make-hasheq))) + (box + (call-in-sandbox-context + ev + (lambda () + (let ([s (open-output-string)]) + (parameterize ([current-output-port s]) + (map (current-print) v)) + (get-output-string s))))))) (get-output ev) (get-error-output ev)))]) (when expect diff --git a/collects/scribblings/scribble/eval.scrbl b/collects/scribblings/scribble/eval.scrbl index 4c50f071..0bc1aca0 100644 --- a/collects/scribblings/scribble/eval.scrbl +++ b/collects/scribblings/scribble/eval.scrbl @@ -25,12 +25,24 @@ set to @racket['string]. If @racket[eval] is not provided, an evaluator is created using @racket[make-base-eval]. See also @racket[make-eval-factory]. +If the value of @racket[current-print] in the sandbox is changed from +its default value, or if @racket[print-as-expression] in the sandbox +is set to @racket[#f], then each evaluation result is formatted to a +string by applying @racket[(current-print)] to the value (with the +output port set to a string port). Otherwise, result values are +typeset using @racket[to-element/no-color]. + Uses of @racket[code:comment] and @racketidfont{code:blank} are stipped from each @racket[datum] before evaluation. If a @racket[datum] has the form @racket[(@#,indexed-racket[eval:alts] #,(svar show-datum) #,(svar eval-datum))], then @svar[show-datum] is -typeset, while @svar[eval-datum] is evaluated.} +typeset, while @svar[eval-datum] is evaluated. + +If a @racket[datum] has the form +@racket[(@#,indexed-racket[eval:check] #,(svar eval-datum) #,(svar +expect-datum))], then both @svar[eval-datum] and @svar[check-datum] +are evaluated, and an error is raised if they are not @racket[equal?].} @defform*[[(interaction-eval datum) @@ -90,8 +102,8 @@ prompt, and with line of space after it.} @defproc[(make-base-eval) (any/c . -> . any)]{ Creates an evaluator using @racket[(make-evaluator 'racket/base)], -setting sandbox parameters to disable limits, set the outputs to -@racket['string], and not add extra security guards.} +setting sandbox parameters to disable limits, setting the outputs to +@racket['string], and not adding extra security guards.} @defproc[(make-base-eval-factory [mod-paths (listof module-path?)]) (-> (any/c . -> . any))]{ @@ -105,7 +117,7 @@ time) and then attached to each evaluator that is created.} @defproc[(make-eval-factory [mod-paths (listof module-path?)]) (-> (any/c . -> . any))]{ -Like @racket[make-base-eval-factor], but each module in @racket[mod-paths] is +Like @racket[make-base-eval-factory], but each module in @racket[mod-paths] is also required into the top-level environment for each generated evaluator.} From 0802093808cd03720f957ea2cf3440e1f7466d73 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Wed, 25 Aug 2010 16:10:55 -0400 Subject: [PATCH 18/54] Lots of "~e" to "~.s" changes. original commit: 606b7f60dc597a6870efc11364e1dd3e1a8b4a1b --- collects/scribble/racket.rkt | 2 +- collects/tests/scribble/reader.rkt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/collects/scribble/racket.rkt b/collects/scribble/racket.rkt index 8029f4eb..62ef0798 100644 --- a/collects/scribble/racket.rkt +++ b/collects/scribble/racket.rkt @@ -441,7 +441,7 @@ (let ([l (syntax->list c)] [h? highlight?]) (unless (and l (= 2 (length l))) - (error "bad code:redex: ~e" (syntax->datum c))) + (error "bad code:redex: ~.s" (syntax->datum c))) (advance c init-line!) (set! src-col (syntax-column (cadr l))) (hash-set! next-col-map src-col dest-col) diff --git a/collects/tests/scribble/reader.rkt b/collects/tests/scribble/reader.rkt index 53ea81e3..2eefa2d5 100644 --- a/collects/tests/scribble/reader.rkt +++ b/collects/tests/scribble/reader.rkt @@ -871,7 +871,7 @@ END-OF-TESTS [(column=) syntax-column] [(position=) syntax-position] [(span=) syntax-span] - [else (error 'syntax-test "unknown test form: ~e" (car y))]) + [else (error 'syntax-test "unknown test form: ~.s" (car y))]) x) (cadr y)) (check-stx x (cddr y))] From 33646442c8aaf3d47a5ea9114dcc73be10104edd Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Thu, 26 Aug 2010 12:10:48 -0400 Subject: [PATCH 19/54] More "~n" -> "\n" changes original commit: 8e0f8dd39c3744472b450021f003f9cbe8cbcb62 --- collects/scribble/html-render.rkt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/scribble/html-render.rkt b/collects/scribble/html-render.rkt index 58483b1e..c31021c9 100644 --- a/collects/scribble/html-render.rkt +++ b/collects/scribble/html-render.rkt @@ -1046,7 +1046,7 @@ (begin (when #f (fprintf (current-error-port) - "Undefined link: ~s~n" + "Undefined link: ~s\n" (tag-key (link-element-tag e) ri))) `((font ([class "badlink"]) ,@(if (empty-content? (element-content e)) From 1f2fee4d7bd27581ea3051e92f9dca82cb981224 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 30 Aug 2010 07:50:05 -0600 Subject: [PATCH 20/54] new guidance in the documentation style guide original commit: c1bf118cb5478cc7be53ec1cad1b651b9eda0454 --- collects/scribblings/scribble/style.scrbl | 72 ++++++++++++++++++++++- 1 file changed, 69 insertions(+), 3 deletions(-) diff --git a/collects/scribblings/scribble/style.scrbl b/collects/scribblings/scribble/style.scrbl index ad34b399..169e7353 100644 --- a/collects/scribblings/scribble/style.scrbl +++ b/collects/scribblings/scribble/style.scrbl @@ -2,10 +2,22 @@ @(require scribble/manual scribble/eval "utils.ss" - (for-label scribble/manual)) + (for-label scribble/manual + scribble/eval)) @title[#:tag "reference-style"]{Style Guide} +Consistent style---for terms, typesetting, and prose---makes +documentation clearer. As much as possible, follow the rules listed in +this section. Many of the rules are arbitrary in the sense that a +different choice of rule could work fine, but the only way to make our +documentation consistent is to pick one of the choices. + +There are too many rules to absorb easily on a first reading. Re-read +this section after writing documentation for a library or two, and +revisit the section periodically to refresh your memory and check for +new rules. + @section{Prose and Terminology} In the descriptive body of @racket[defform], @racket[defproc], etc., @@ -24,6 +36,18 @@ or a ``symbol.'' Do not use the word ``expression'' for a form that is a definition or might be a definition; use the word ``form,'' instead. Prefer ``function'' to ``procedure.'' +Use the word ``list'' only when you mean a run-time value consisting +of the empty list and cons cells; use the word ``sequence'' in other +cases, if you must use any word. For example, do not write that +@racket[begin] has a ``list of sub-forms;'' instead, it has a +``sequence of subforms.'' Similarly, do not refer to a ``list of +arguments'' in a function call; just write ``arguments'' if possible, +or write ``sequence of argument expressions.'' (Unfortunately, +``@tech[#:doc '(lib +"scribblings/reference/reference.scrbl")]{sequence}'' has acquired a +specific run-time meaning, too, but the collision is less severe than +the historical confusion between lists and other entities in Lisp.) + Avoid cut-and-paste for descriptive text. If two functions are similar, consider documenting them together with @racket[deftogether]. To abstract a description, consider using @@ -40,7 +64,8 @@ Use @racketidfont{id} or a name that ends @racketidfont{-id} in @racketidfont{symbol}. Similarly, use @racketidfont{expr} or something that ends @racketidfont{-expr} for an expression position within a syntactic form. Use @racketidfont{body} for a form (definition or -expression) in an internal-definition position. Do not use +expression) in an internal-definition position---always followed by +@racket[...+] in a grammar description. Do not use @racketidfont{expr} for something that isn't exactly an expression, @racket[id] for something that isn't exactly an identifier, etc.; instead, use @racket[defform/subs] to define a new non-terminal. @@ -89,7 +114,7 @@ When showing example evaluations, use the REPL-snapshot style: ] }| -See also the @racket[scribble/eval] library. +See also the @racket[scribble/eval] library and @secref["examples-style"]. Use four dots, @litchar{....}, in place of omitted code, since @litchar{...} means repetition. @@ -108,6 +133,7 @@ in HTML output. Use American style for quotation marks and punctuation @; and there's no harm in doing the more logical thing of putting @; the punctuations outside quotations and parens. Just like you @; did at the end of this sentence... +@; [Matthew] See intro of this section. at the end of quotation marks (i.e., a sentence-terminating period goes inside the quotation marks). Of course, this rule does not apply for quotation marks that are part of code. @@ -130,3 +156,43 @@ the key word is primarily an executable name, use @racket[exec] instead of @racket[bold]. Optionally add further descriptive text in the title after a colon, where the text starting with the colon is not in boldface. + +@section{Indexing} + +Document and section titles, identifiers that are documented with +@racket[defproc], @racket[defform], etc. are automatically indexed, as +are terms defined with @racket[deftech]. + +Symbols are not indexed automatically. Use @racket[indexed-racket] +instead of @racket[racket] for the instance of a symbol that roughly +defines the use. For an example, try searching for ``truncate'' to +find @racket['truncate] as used with @racket[open-output-file]. Do no +use something like @racket[(index "'truncate")] to index a symbol, +because it will not typeset correctly (i.e., in a fixed-width font +with the color of a literal). + +Use @racket[index], @racket[as-index], and @racket[section-index] as a +last resort. Create index entries for terms that are completely +different from terms otherwise indexed. Do not try to index minor +variations of a term or phrase in an attempt to improve search +results; if search fails to find a word or phrase due to a minor +variation, then the search algorithm should be fixed, not the index +entry. + +@section[#:tag "examples-style"]{Examples} + +Strive to include examples (using @racket[examples]) with the +documentation of every function and syntactic form. When writing +examples, refrain from using nonsense words like ``foo'' and ``bar.'' +For example, when documenting @racket[member], resist the temptation +to write + +@interaction[ +(member "foo" '("bar" "foo" "baz")) +] + +and instead write something like + +@interaction[ +(member "Groucho" '("Harpo" "Groucho" "Zeppo")) +] From c9b2f68f59e3924d5a0533d6f886e4f924a0c848 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 30 Aug 2010 07:58:16 -0600 Subject: [PATCH 21/54] move style guide up a section (to its own page) original commit: 8c2ba47fa5778906e091cabc87fbf3cc6724881c --- collects/scribblings/scribble/how-to.scrbl | 3 --- collects/scribblings/scribble/plt.scrbl | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/collects/scribblings/scribble/how-to.scrbl b/collects/scribblings/scribble/how-to.scrbl index de61a924..2ef05321 100644 --- a/collects/scribblings/scribble/how-to.scrbl +++ b/collects/scribblings/scribble/how-to.scrbl @@ -379,6 +379,3 @@ include introductory text before the call of important and when when local table of contents is short, putting the introductory text after the call of @racket[local-table-of-contents] may be appropriate. - -@;---------------------------------------- -@include-section["style.scrbl"] diff --git a/collects/scribblings/scribble/plt.scrbl b/collects/scribblings/scribble/plt.scrbl index 89b1a04a..2d79866b 100644 --- a/collects/scribblings/scribble/plt.scrbl +++ b/collects/scribblings/scribble/plt.scrbl @@ -16,6 +16,7 @@ relevant libraries and APIs in detail. @local-table-of-contents[] @include-section["how-to.scrbl"] +@include-section["style.scrbl"] @include-section["manual.scrbl"] @include-section["scheme.scrbl"] @include-section["eval.scrbl"] From b00ddd6619324b497aa7ed53d5bfa78222c06d37 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Wed, 8 Sep 2010 15:11:56 -0400 Subject: [PATCH 22/54] Spit out a warning if there are no files rendered. Fix a reference to meta/web to be symbolic -- otherwise things can get confused when symlinks are used, ending up with two instances of a single modeule (once for the symbolic reference and one for a relative one). It's still best to avoid symlinks, though. Simplify version specs in the techreports code, re-enable continue reference, some reformatting. original commit: 35f77f61ade51defb46cf01a5cc91c8c5fdd4a94 --- collects/meta/web/html/resource.rkt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/collects/meta/web/html/resource.rkt b/collects/meta/web/html/resource.rkt index 774a299c..30458d48 100644 --- a/collects/meta/web/html/resource.rkt +++ b/collects/meta/web/html/resource.rkt @@ -218,9 +218,11 @@ (provide render-all) (define (render-all) (printf "Rendering...\n") - (let loop () - (let ([todo (get/reset-renderers)]) + (define todo (get/reset-renderers)) + (if (null? todo) + (printf " Warning: no content to render\n") + (let loop ([todo todo]) (unless (null? todo) (for-each (lambda (r) (r)) todo) - (loop)))) ; if more were created + (loop (get/reset-renderers))))) ; if more were created (printf "Rendering done.\n")) From 189bf9d63ce18022a65e3cd6a7e7eb3d60a4f813 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Thu, 9 Sep 2010 13:46:45 -0500 Subject: [PATCH 23/54] made proc/doc recognize ->i contracts original commit: 711fe506412f45fdbccb84e76fb88622a06050e3 --- collects/scribble/srcdoc.rkt | 47 +++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/collects/scribble/srcdoc.rkt b/collects/scribble/srcdoc.rkt index 454e85d5..e09ff9d6 100644 --- a/collects/scribble/srcdoc.rkt +++ b/collects/scribble/srcdoc.rkt @@ -53,12 +53,21 @@ p/c ... (void (quote-syntax (provide/doc (for-docs id) ...)))))))])) +(define-for-syntax (remove->i-deps stx) + (syntax-case stx () + [(id (id2 ...) ctc) + #'(id ctc)] + [(id ctc) + #'(id ctc)] + [else + (error 'remove->i-deps "unknown thing ~s" stx)])) + (define-provide/doc-transformer proc-doc (lambda (stx) (syntax-case stx () [(_ id contract desc) (with-syntax ([(header result (body-stuff ...)) - (syntax-case #'contract (->d -> values) + (syntax-case #'contract (->d ->i -> values) [(->d (req ...) () (values [name res] ...)) #'((id req ...) (values res ...) ())] [(->d (req ...) () #:pre-cond condition (values [name res] ...)) @@ -82,6 +91,42 @@ (format "unsupported ->d contract form for ~a" (syntax->datum #'id)) stx #'contract)] + + [(->i (req ...) () (values ress ...)) + (with-syntax ([(req ...) (map remove->i-deps (syntax->list #'(req ...)))] + [([name res] ...) (map remove->i-deps (syntax->list #'(req ...)))]) + #'((id req ...) (values res ...) ()))] + [(->i (req ...) () #:pre (pre-id ...) condition (values ress ...)) + (with-syntax ([(req ...) (map remove->i-deps (syntax->list #'(req ...)))] + [([name res] ...) (map remove->i-deps (syntax->list #'(req ...)))]) + #'((id req ...) (values res ...) ((bold "Pre-condition: ") (scheme condition) "\n" "\n")))] + [(->i (req ...) () res) + (with-syntax ([(req ...) (map remove->i-deps (syntax->list #'(req ...)))] + [[name res] (remove->i-deps #'res)]) + #'((id req ...) res ()))] + [(->i (req ...) () #:pre (pre-id ...) condition [name res]) + (with-syntax ([(req ...) (map remove->i-deps (syntax->list #'(req ...)))] + [[name res] (remove->i-deps #'res)]) + #'((id req ...) res ((bold "Pre-condition: ") (scheme condition) "\n" "\n" )))] + [(->i (req ...) () #:rest rest res) + (with-syntax ([(req ...) (map remove->i-deps (syntax->list #'(req ...)))] + [[name res] (remove->i-deps #'res)] + [[name-t rest-ctc] (remove->i-deps #'rest)]) + #'((id req ... [name-t rest-ctc] (... ...)) res ()))] + [(->i (req ...) (one more ...) whatever) + (raise-syntax-error + #f + (format "unsupported ->i contract form for ~a, optional arguments non-empty, must use proc-doc/names" + (syntax->datum #'id)) + stx + #'contract)] + [(->i whatever ...) + (raise-syntax-error + #f + (format "unsupported ->i contract form for ~a" (syntax->datum #'id)) + stx + #'contract)] + [(-> result) #'((id) result ())] [(-> whatever ...) From 313176569f59d94b3ae9c6c48dc1ef2fb9082b1c Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Mon, 20 Sep 2010 11:17:50 -0400 Subject: [PATCH 24/54] Allow getting the absolute URL of a resource original commit: 93bd86ccc4f8d7e2ab822a5fd3f1306c445c0b2e --- collects/meta/web/html/resource.rkt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/collects/meta/web/html/resource.rkt b/collects/meta/web/html/resource.rkt index 30458d48..0a95328d 100644 --- a/collects/meta/web/html/resource.rkt +++ b/collects/meta/web/html/resource.rkt @@ -197,16 +197,20 @@ (printf " ~a\n" path) (renderer filename)))))) (define (url) (relativize filename dirpathlist (rendered-dirpath))) + (define absolute-url (delay (relativize filename dirpathlist ""))) (add-renderer path render) (make-keyword-procedure (lambda (kws kvs . args) (keyword-apply referrer kws kvs (url) args)) - (case-lambda [(x) (if (eq? x get-resource-path) (url) (referrer (url) x))] + (case-lambda [(x) (if (and (pair? x) (eq? (car x) get-path)) + (if (cdr x) absolute-url (url)) + (referrer (url) x))] [args (apply referrer (url) args)])))) ;; make it possible to always get the path to a resource (provide get-resource-path) -(define (get-resource-path resource) - (resource get-resource-path)) +(define get-path (gensym)) +(define (get-resource-path resource [absolute? #f]) + (resource (cons get-path absolute?))) ;; a convenient utility to create renderers from some output function (like ;; `output-xml' or `display') and some content From 4b9fcbcb7e7acc7b57d26b744588b065d28b793d Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Thu, 7 Oct 2010 15:46:05 -0600 Subject: [PATCH 25/54] Allowing full require spec stx in require/doc original commit: c74c94d6fdef8abaaa901819cbaba9d14b1beffa --- collects/scribble/extract.rkt | 47 ++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/collects/scribble/extract.rkt b/collects/scribble/extract.rkt index 679b8042..7e0fdc82 100644 --- a/collects/scribble/extract.rkt +++ b/collects/scribble/extract.rkt @@ -5,6 +5,7 @@ scribble/srcdoc (for-syntax scheme/base scheme/path + scheme/list syntax/path-spec (for-syntax scheme/base))) @@ -55,35 +56,41 @@ (syntax->list #'(spec ...))] [_ null])) (syntax->list #'(content ...))))] + [(doc-req ...) + (map + strip-context + (append-map (lambda (c) + (syntax-case c (#%plain-app void quote-syntax require/doc) + [(#%plain-app void (quote-syntax (require/doc spec ...))) + (syntax->list #'(spec ...))] + [_ null])) + (syntax->list #'(content ...))))] [(req ...) (map strip-context - (apply - append - (map (lambda (c) - (syntax-case c (#%require #%plain-app void quote-syntax require/doc) - [(#%require spec ...) - (let loop ([specs (syntax->list #'(spec ...))]) - (cond - [(null? specs) '()] - [else (let ([spec (car specs)]) - (syntax-case spec (for-syntax for-meta) - [(for-syntax . spec) (loop (cdr specs))] - [(for-meta . spec) (loop (cdr specs))] - [(for-template . spec) (loop (cdr specs))] - [(for-label . spec) (loop (cdr specs))] - [(just-meta . spec) (loop (cdr specs))] - [_ (cons #`(for-label #,spec) (loop (cdr specs)))]))]))] - [(#%plain-app void (quote-syntax (require/doc spec ...))) - (syntax->list #'(spec ...))] - [_ null])) - (syntax->list #'(content ...)))))] + (append-map (lambda (c) + (syntax-case c (#%require) + [(#%require spec ...) + (let loop ([specs (syntax->list #'(spec ...))]) + (cond + [(null? specs) '()] + [else (let ([spec (car specs)]) + (syntax-case spec (for-syntax for-meta) + [(for-syntax . spec) (loop (cdr specs))] + [(for-meta . spec) (loop (cdr specs))] + [(for-template . spec) (loop (cdr specs))] + [(for-label . spec) (loop (cdr specs))] + [(just-meta . spec) (loop (cdr specs))] + [_ (cons #`(for-label #,spec) (loop (cdr specs)))]))]))] + [_ null])) + (syntax->list #'(content ...))))] [orig-tag (datum->syntax #f 'orig)]) ;; This template is matched in `filter-info', below #`(begin (#%require (for-label #,(strip-context #'lang)) (for-label #,(strip-context orig-path)) req ...) + (require doc-req ...) (drop-first (quote-syntax id) (def-it orig-tag content)) ...))])))) (define-syntax (include-extracted stx) From bd7d0f1ba8a66045385378f1d0d68b9c3b988cbe Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Thu, 7 Oct 2010 18:35:25 -0600 Subject: [PATCH 26/54] Stupidly forgot to adjust pattern mentioned in the place that I changed original commit: b9b7bb784af96679391d4bbbc44f3870e782c74a --- collects/scribble/extract.rkt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/collects/scribble/extract.rkt b/collects/scribble/extract.rkt index 7e0fdc82..4f75ad4f 100644 --- a/collects/scribble/extract.rkt +++ b/collects/scribble/extract.rkt @@ -101,7 +101,7 @@ (define-syntax (provide-extracted stx) (syntax-case stx () [(_ orig-path) - (with-syntax ([(_begin reqs (_drop-first (_quote-syntax id) def) ...) + (with-syntax ([(_begin reqs doc-reqs (_drop-first (_quote-syntax id) def) ...) (extract #'orig-path stx)]) #'(begin (require (for-label (only-in orig-path))) ;; creates build dependency @@ -137,6 +137,7 @@ [(box? stx) #`(box #,(loop (unbox stx)))] [else #`(quote #,stx)]))]))]) #`(begin #,(quote-syntax/loc reqs) + #,(quote-syntax/loc doc-reqs) #,@(filter values (map (lambda (i d) From f5d1244f613f6f13032a9e3923d5a3e8995de496 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 8 Oct 2010 18:35:05 -0600 Subject: [PATCH 27/54] set `read-accept-lang' to #t by default, plus related adjustments including adding some uses of `with-module-read-parameterization' so that `read-accept-lang' is set right anyway; still, so many many places just set `read-accept-reader' to #t that making `read-accept-lang' #f by default looks like too big of an incompatibility original commit: 6ac33a62be6e2b855049307ce797832a40f9d1de --- collects/scribble/extract.rkt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/collects/scribble/extract.rkt b/collects/scribble/extract.rkt index 4f75ad4f..0f928571 100644 --- a/collects/scribble/extract.rkt +++ b/collects/scribble/extract.rkt @@ -7,6 +7,7 @@ scheme/path scheme/list syntax/path-spec + syntax/modread (for-syntax scheme/base))) (provide include-extracted @@ -35,14 +36,15 @@ n-path)]) (let ([s-exp (parameterize ([current-namespace (make-base-namespace)] - [read-accept-reader #t] [current-load-relative-directory (path-only path)]) (expand - (with-input-from-file path - (lambda () - (port-count-lines! (current-input-port)) - (read-syntax path)))))]) + (with-module-reading-parameterization + (lambda () + (with-input-from-file path + (lambda () + (port-count-lines! (current-input-port)) + (read-syntax path)))))))]) (syntax-case s-exp () [(mod name lang (mod-beg From 68e6777bc87545ac69bd9ed4dd7ce405e53c89f3 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Mon, 11 Oct 2010 15:01:03 -0400 Subject: [PATCH 28/54] Some additional tests, and use () instead of {} for racket sexprs original commit: 62958248515545e62f1bc0c7027d4b729f8baf36 --- collects/tests/scribble/reader.rkt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/collects/tests/scribble/reader.rkt b/collects/tests/scribble/reader.rkt index 2eefa2d5..41997d20 100644 --- a/collects/tests/scribble/reader.rkt +++ b/collects/tests/scribble/reader.rkt @@ -91,7 +91,13 @@ fo@o -@-> fo@o --- @[foo] -@-> (foo) --- -@|{blah}| -@-> {"blah"} +@{@foo bar} -@-> (foo " bar") +--- +@|{blah}| -@-> ("blah") +--- +@|{blah|@foo bleh}| -@-> ("blah" foo " bleh") +--- +@|{|@meh blah|@foo bleh}| -@-> (meh " blah" foo " bleh") --- ;; -------------------- newlines and spaces in text --- From 47d955917b8d544b19d59023b9255e18e78fa531 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Tue, 19 Oct 2010 21:06:32 -0400 Subject: [PATCH 29/54] Fix rendering in local build mode -- make it create file:// urls when insisting on an absolute url (currently happens only in the tr pages). original commit: 1e2d4b816946b9ab94c572ac5bae53d688bc4ed8 --- collects/meta/web/html/resource.rkt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/collects/meta/web/html/resource.rkt b/collects/meta/web/html/resource.rkt index 0a95328d..54632f4e 100644 --- a/collects/meta/web/html/resource.rkt +++ b/collects/meta/web/html/resource.rkt @@ -47,10 +47,10 @@ (define cached-roots '(#f . #f)) (define (current-url-roots) - ;; takes in a (listof (list prefix-string url-string . flags)), and produces - ;; an alist with lists of strings for the keys; the prefix-strings are split - ;; on "/"s, and the url-strings can be anything at all actually (they are put - ;; as-is before the path with a "/" between them). + ;; takes `url-roots', a (listof (list prefix-string url-string . flags)), and + ;; produces an alist with lists of strings for the keys; the prefix-strings + ;; are split on "/"s, and the url-strings can be anything at all actually + ;; (they are put as-is before the path with a "/" between them). (let ([roots (url-roots)]) (unless (eq? roots (car cached-roots)) (set! cached-roots @@ -86,7 +86,7 @@ ;; find shared prefix [(and (pair? t) (pair? c) (equal? (car t) (car c))) (loop (cdr t) (cdr c) (cons (car t) pfx))] - ;; done + ;; done with the shared prefix, deal with the root now ;; no roots => always use a relative path (useful for debugging) [(not roots) `(,@(map (lambda (_) "..") c) ,@t ,file*)] ;; share a root => use a relative path unless its an absolute root @@ -197,7 +197,13 @@ (printf " ~a\n" path) (renderer filename)))))) (define (url) (relativize filename dirpathlist (rendered-dirpath))) - (define absolute-url (delay (relativize filename dirpathlist ""))) + (define absolute-url + (delay (let ([url (relativize filename dirpathlist '())]) + (if (url-roots) + url + ;; we're in local build mode, and insist on an absolute url, + ;; so construct a `file://' result + (list* "file://" (current-directory) url))))) (add-renderer path render) (make-keyword-procedure (lambda (kws kvs . args) (keyword-apply referrer kws kvs (url) args)) From 1013d7841503b5d9354ff109933b8a7e89d4638f Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Tue, 26 Oct 2010 05:20:02 -0400 Subject: [PATCH 30/54] Provide `process-begin/text' to make it convenient to define more `scribble/text'-like languages. Use it to define a convenient syntax for html modules. This is not used by the web content files since they define functions rather than spit out html when required, but makes it convenient to make an html markup language similar to scribble/text. original commit: 7ac83e25c90c4d05b9e9e39be678b32790e94f31 --- collects/meta/web/html/main.rkt | 17 +++++++++++------ collects/scribble/text/lang/reader.rkt | 5 ++--- collects/scribble/text/syntax-utils.rkt | 4 ++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/collects/meta/web/html/main.rkt b/collects/meta/web/html/main.rkt index f778e81b..aab0a8c2 100644 --- a/collects/meta/web/html/main.rkt +++ b/collects/meta/web/html/main.rkt @@ -1,16 +1,16 @@ #lang racket/base -(provide (except-out (all-from-out racket/base) #%top) - (rename-out [top #%top]) - ;; to be used as a text language +(provide (except-out (all-from-out racket/base) #%top #%module-begin) + (rename-out [top #%top] [module-begin #%module-begin]) + ;; to be used as a text language (output via `output-xml') (all-from-out scribble/text) - ;; provide a `text' alias - (rename-out [begin/text text]) + ;; provide a `text' alias and an `include' alias + (rename-out [begin/text text] [include/text include]) ;; main functionality (all-from-out "xml.rkt" "html.rkt" "resource.rkt")) (require "xml.rkt" "html.rkt" "resource.rkt" - scribble/text (for-syntax racket/base)) + scribble/text scribble/text/syntax-utils (for-syntax racket/base)) (define-syntax (top stx) (syntax-case stx () @@ -19,3 +19,8 @@ (if (and (symbol? x*) (regexp-match? #rx":$" (symbol->string x*))) #''x #'(#%top . x)))])) + +(define-syntax-rule (module-begin expr ...) + (#%plain-module-begin + (port-count-lines! (current-output-port)) + (process-begin/text begin output-xml expr ...))) diff --git a/collects/scribble/text/lang/reader.rkt b/collects/scribble/text/lang/reader.rkt index d9660753..8c6ab72d 100644 --- a/collects/scribble/text/lang/reader.rkt +++ b/collects/scribble/text/lang/reader.rkt @@ -7,6 +7,5 @@ scribble/text/textlang #:whole-body-readers? #t #:info (scribble-base-reader-info) -(require (prefix-in scribble: "../../reader.ss") - (only-in scribble/base/reader - scribble-base-reader-info)) +(require (prefix-in scribble: scribble/reader) + (only-in scribble/base/reader scribble-base-reader-info)) diff --git a/collects/scribble/text/syntax-utils.rkt b/collects/scribble/text/syntax-utils.rkt index 5ec450eb..fea2a061 100644 --- a/collects/scribble/text/syntax-utils.rkt +++ b/collects/scribble/text/syntax-utils.rkt @@ -2,8 +2,8 @@ (require "output.ss" (for-syntax scheme/base syntax/kerncase)) -(provide module-begin/text begin/text include/text - begin/collect) +(provide module-begin/text begin/text include/text begin/collect + process-begin/text) (begin-for-syntax (define definition-ids ; ids that don't require forcing From 28ba6a19197199d80906aeeecc1bd7a4bbee078d Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Tue, 26 Oct 2010 07:13:53 -0400 Subject: [PATCH 31/54] Add `racket/list' and `racket/string' to the web language, adjust existing requires. (It's supposed to be a convenient language...) original commit: ed5033159a6a526d717aa2c1396c351e0f1da5e3 --- collects/meta/web/html/main.rkt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/collects/meta/web/html/main.rkt b/collects/meta/web/html/main.rkt index aab0a8c2..7b051527 100644 --- a/collects/meta/web/html/main.rkt +++ b/collects/meta/web/html/main.rkt @@ -7,9 +7,10 @@ ;; provide a `text' alias and an `include' alias (rename-out [begin/text text] [include/text include]) ;; main functionality - (all-from-out "xml.rkt" "html.rkt" "resource.rkt")) + (all-from-out "xml.rkt" "html.rkt" "resource.rkt" + racket/list racket/string)) -(require "xml.rkt" "html.rkt" "resource.rkt" +(require "xml.rkt" "html.rkt" "resource.rkt" racket/list racket/string scribble/text scribble/text/syntax-utils (for-syntax racket/base)) (define-syntax (top stx) From a89b7b0608aed84bafd319fbaec48acc2f119fbf Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Tue, 26 Oct 2010 09:26:51 -0400 Subject: [PATCH 32/54] Move `meta/web/html' to `scribble/html'. (See http://lists.racket-lang.org/dev/archive/2010-October/004691.html for a discussion on calling it `html' rather than `xhtml'.) original commit: ca040ea42a7fa2bfb5e5332bee81ab41fec28b82 --- collects/{meta/web => scribble}/html.rkt | 0 collects/{meta/web => scribble}/html/html.rkt | 0 collects/{meta/web => scribble}/html/main.rkt | 0 collects/{meta/web => scribble}/html/resource.rkt | 0 collects/{meta/web => scribble}/html/xml.rkt | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename collects/{meta/web => scribble}/html.rkt (100%) rename collects/{meta/web => scribble}/html/html.rkt (100%) rename collects/{meta/web => scribble}/html/main.rkt (100%) rename collects/{meta/web => scribble}/html/resource.rkt (100%) rename collects/{meta/web => scribble}/html/xml.rkt (100%) diff --git a/collects/meta/web/html.rkt b/collects/scribble/html.rkt similarity index 100% rename from collects/meta/web/html.rkt rename to collects/scribble/html.rkt diff --git a/collects/meta/web/html/html.rkt b/collects/scribble/html/html.rkt similarity index 100% rename from collects/meta/web/html/html.rkt rename to collects/scribble/html/html.rkt diff --git a/collects/meta/web/html/main.rkt b/collects/scribble/html/main.rkt similarity index 100% rename from collects/meta/web/html/main.rkt rename to collects/scribble/html/main.rkt diff --git a/collects/meta/web/html/resource.rkt b/collects/scribble/html/resource.rkt similarity index 100% rename from collects/meta/web/html/resource.rkt rename to collects/scribble/html/resource.rkt diff --git a/collects/meta/web/html/xml.rkt b/collects/scribble/html/xml.rkt similarity index 100% rename from collects/meta/web/html/xml.rkt rename to collects/scribble/html/xml.rkt From 0bb6cd944af9b50e3fef49877aa6c25a57b7f92c Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Tue, 26 Oct 2010 15:36:29 -0400 Subject: [PATCH 33/54] Make the `scribble/html' layout mimic the one for `scribble/text'. Ie, the difference between using it as a language and as a module is now the same in both. Also, improve `scribble/html' (and `scribble/html/htmllang') by reproviding most of the corresponding text modules. Change `meta/web' accordingly, and improve code by making a new langugae (`#lang meta/web'). This language is similar to `scribble/html' except that it uses the plain scribble reader (not the `-inside' one), it doesn't use the customized module-begin feature (that uses `output-xml'), and it adds all the relevant bits of `meta/web/common'. (Also, "meta/web/common.rkt" is gone, since it's used only as a language now.) This commit has lots of details and binding games, so it's tricky, and potentially caused some problems. (Took me a while to track many breakages, so I won't be surprised if there are more.) original commit: 82221a51db9648d74caef31837b1f00b4e9d5773 --- collects/scribble/html/htmllang.rkt | 22 ++++++++++++++++++++++ collects/scribble/html/main.rkt | 28 ++++------------------------ collects/scribble/text.rkt | 5 ++--- collects/scribble/text/main.rkt | 7 +++++++ collects/scribble/text/textlang.rkt | 8 ++++---- 5 files changed, 39 insertions(+), 31 deletions(-) create mode 100644 collects/scribble/html/htmllang.rkt create mode 100644 collects/scribble/text/main.rkt diff --git a/collects/scribble/html/htmllang.rkt b/collects/scribble/html/htmllang.rkt new file mode 100644 index 00000000..4d47215f --- /dev/null +++ b/collects/scribble/html/htmllang.rkt @@ -0,0 +1,22 @@ +#lang racket/base + +(require "main.rkt" scribble/text/textlang scribble/text/syntax-utils + (for-syntax racket/base)) + +(provide (except-out (all-from-out scribble/text/textlang) + #%top #%module-begin) + (rename-out [top #%top] [module-begin #%module-begin]) + (all-from-out "main.rkt")) + +(define-syntax (top stx) + (syntax-case stx () + [(_ . x) + (let ([x* (syntax-e #'x)]) + (if (and (symbol? x*) (regexp-match? #rx":$" (symbol->string x*))) + #''x + #'(#%top . x)))])) + +(define-syntax-rule (module-begin expr ...) + (#%plain-module-begin + (port-count-lines! (current-output-port)) + (process-begin/text begin output-xml expr ...))) diff --git a/collects/scribble/html/main.rkt b/collects/scribble/html/main.rkt index 7b051527..0ab3b2aa 100644 --- a/collects/scribble/html/main.rkt +++ b/collects/scribble/html/main.rkt @@ -1,27 +1,7 @@ #lang racket/base -(provide (except-out (all-from-out racket/base) #%top #%module-begin) - (rename-out [top #%top] [module-begin #%module-begin]) - ;; to be used as a text language (output via `output-xml') - (all-from-out scribble/text) - ;; provide a `text' alias and an `include' alias - (rename-out [begin/text text] [include/text include]) - ;; main functionality - (all-from-out "xml.rkt" "html.rkt" "resource.rkt" - racket/list racket/string)) +(require "xml.rkt" "html.rkt" "resource.rkt" + ;; includes all of the scribble/text utilities + scribble/text) -(require "xml.rkt" "html.rkt" "resource.rkt" racket/list racket/string - scribble/text scribble/text/syntax-utils (for-syntax racket/base)) - -(define-syntax (top stx) - (syntax-case stx () - [(_ . x) - (let ([x* (syntax-e #'x)]) - (if (and (symbol? x*) (regexp-match? #rx":$" (symbol->string x*))) - #''x - #'(#%top . x)))])) - -(define-syntax-rule (module-begin expr ...) - (#%plain-module-begin - (port-count-lines! (current-output-port)) - (process-begin/text begin output-xml expr ...))) +(provide (all-from-out "xml.rkt" "html.rkt" "resource.rkt" scribble/text)) diff --git a/collects/scribble/text.rkt b/collects/scribble/text.rkt index 90c106d5..36f57156 100644 --- a/collects/scribble/text.rkt +++ b/collects/scribble/text.rkt @@ -1,5 +1,4 @@ #lang racket/base -(require racket/promise "text/output.ss" "text/syntax-utils.ss") -(provide (all-from-out racket/promise "text/output.ss") - begin/text include/text) +(require "text/main.rkt") +(provide (all-from-out "text/main.rkt")) diff --git a/collects/scribble/text/main.rkt b/collects/scribble/text/main.rkt new file mode 100644 index 00000000..5cc7ae6a --- /dev/null +++ b/collects/scribble/text/main.rkt @@ -0,0 +1,7 @@ +#lang racket/base + +(require "output.ss" "syntax-utils.ss" + racket/promise racket/list racket/string) + +(provide (all-from-out "output.ss" racket/promise racket/list racket/string) + begin/text include/text) diff --git a/collects/scribble/text/textlang.rkt b/collects/scribble/text/textlang.rkt index 0708781f..3df5a5a9 100644 --- a/collects/scribble/text/textlang.rkt +++ b/collects/scribble/text/textlang.rkt @@ -1,9 +1,9 @@ #lang racket/base -(require "syntax-utils.ss" "output.ss" racket/promise) +(require "syntax-utils.ss" "output.ss" + racket/promise racket/list racket/string) (provide (except-out (all-from-out racket/base) #%module-begin) - (all-from-out "output.ss" racket/promise) - begin/text + (all-from-out "output.ss" racket/promise racket/list racket/string) (rename-out [module-begin/text #%module-begin] - [include/text include])) + [begin/text text] [include/text include])) From 391eb096b7854186212621f54901d485aec27f7a Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Tue, 26 Oct 2010 16:17:09 -0400 Subject: [PATCH 34/54] More name improvements: `scribble/text/textlang' -> `scribble/text/lang' and the same for `scribble/html/lang'. original commit: 69a490c10b4964ea174f31a8b992e034ff3fb270 --- collects/scribble/html/{htmllang.rkt => lang.rkt} | 5 ++--- collects/scribble/text/{textlang.rkt => lang.rkt} | 0 collects/scribble/text/lang/reader.rkt | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) rename collects/scribble/html/{htmllang.rkt => lang.rkt} (75%) rename collects/scribble/text/{textlang.rkt => lang.rkt} (100%) diff --git a/collects/scribble/html/htmllang.rkt b/collects/scribble/html/lang.rkt similarity index 75% rename from collects/scribble/html/htmllang.rkt rename to collects/scribble/html/lang.rkt index 4d47215f..258dd15f 100644 --- a/collects/scribble/html/htmllang.rkt +++ b/collects/scribble/html/lang.rkt @@ -1,10 +1,9 @@ #lang racket/base -(require "main.rkt" scribble/text/textlang scribble/text/syntax-utils +(require "main.rkt" scribble/text/lang scribble/text/syntax-utils (for-syntax racket/base)) -(provide (except-out (all-from-out scribble/text/textlang) - #%top #%module-begin) +(provide (except-out (all-from-out scribble/text/lang) #%top #%module-begin) (rename-out [top #%top] [module-begin #%module-begin]) (all-from-out "main.rkt")) diff --git a/collects/scribble/text/textlang.rkt b/collects/scribble/text/lang.rkt similarity index 100% rename from collects/scribble/text/textlang.rkt rename to collects/scribble/text/lang.rkt diff --git a/collects/scribble/text/lang/reader.rkt b/collects/scribble/text/lang/reader.rkt index 8c6ab72d..19581ab1 100644 --- a/collects/scribble/text/lang/reader.rkt +++ b/collects/scribble/text/lang/reader.rkt @@ -1,6 +1,6 @@ #lang s-exp syntax/module-reader -scribble/text/textlang +scribble/text/lang #:read scribble:read-inside #:read-syntax scribble:read-syntax-inside From 66fb16193f7d4c02277889a3f56a713f80773393 Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Wed, 27 Oct 2010 16:14:03 -0400 Subject: [PATCH 35/54] Fixed a typo in the scribble docs. Merge to 5.0.2. original commit: 25749736c9ccf300c1ad338017030614032f5224 --- collects/scriblib/scribblings/figure.scrbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/scriblib/scribblings/figure.scrbl b/collects/scriblib/scribblings/figure.scrbl index b3500aef..67c84a47 100644 --- a/collects/scriblib/scribblings/figure.scrbl +++ b/collects/scriblib/scribblings/figure.scrbl @@ -22,7 +22,7 @@ rendering support.} )]{ Creates a figure. The given @scheme[tag] is for use with -@scheme[figure-ref] or @scheme[fFgure-ref]. The @scheme[caption] is an +@scheme[figure-ref] or @scheme[Figure-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 From 25c310b0dccf1c9269c0518c45c2107fe9f3660f Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sun, 24 Oct 2010 18:17:21 -0500 Subject: [PATCH 36/54] add missing for-label require original commit: 68b06b42d91f5dc4a1bde9d6979f7d92538b79db --- collects/scribble/private/manual-proc.rkt | 1 + 1 file changed, 1 insertion(+) diff --git a/collects/scribble/private/manual-proc.rkt b/collects/scribble/private/manual-proc.rkt index 076a30d9..a01168bf 100644 --- a/collects/scribble/private/manual-proc.rkt +++ b/collects/scribble/private/manual-proc.rkt @@ -18,6 +18,7 @@ scheme/list (for-syntax racket/base) (for-label racket/base + racket/contract racket/class)) (provide defproc defproc* defstruct defstruct* From 688bb59c1ac8bea389eb9a961856c7a601ef42f9 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Thu, 28 Oct 2010 17:27:30 -0400 Subject: [PATCH 37/54] Move the `#%top' binding that makes `foo:' keywords self evaluating from `scribble/html/lang' to `scribble/html'. Since `foo:' keywords are very common in any code that uses `scribble/html', it is much more convenient to have it provide the custom `#%top'. It simplifies code that uses it, for example, files in `meta/web/common' now use #lang at-exp racket/base (require scribble/html) instead of the (only-in scribble/html/lang #%top) which it used before, or instead of explicitly quoting all `foo:'s. original commit: 58febe21a02ff7c7447ee75bf5edd34c99ee6f1c --- collects/scribble/html/lang.rkt | 17 +++++------------ collects/scribble/html/main.rkt | 12 +++++++++++- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/collects/scribble/html/lang.rkt b/collects/scribble/html/lang.rkt index 258dd15f..3caefb4a 100644 --- a/collects/scribble/html/lang.rkt +++ b/collects/scribble/html/lang.rkt @@ -1,20 +1,13 @@ #lang racket/base -(require "main.rkt" scribble/text/lang scribble/text/syntax-utils - (for-syntax racket/base)) +(require "main.rkt" (except-in scribble/text/lang #%top) + scribble/text/syntax-utils) -(provide (except-out (all-from-out scribble/text/lang) #%top #%module-begin) - (rename-out [top #%top] [module-begin #%module-begin]) +(provide (except-out (all-from-out scribble/text/lang) #%module-begin) + (rename-out [module-begin #%module-begin]) (all-from-out "main.rkt")) -(define-syntax (top stx) - (syntax-case stx () - [(_ . x) - (let ([x* (syntax-e #'x)]) - (if (and (symbol? x*) (regexp-match? #rx":$" (symbol->string x*))) - #''x - #'(#%top . x)))])) - +(require (for-syntax racket/base)) (define-syntax-rule (module-begin expr ...) (#%plain-module-begin (port-count-lines! (current-output-port)) diff --git a/collects/scribble/html/main.rkt b/collects/scribble/html/main.rkt index 0ab3b2aa..789c4fe3 100644 --- a/collects/scribble/html/main.rkt +++ b/collects/scribble/html/main.rkt @@ -4,4 +4,14 @@ ;; includes all of the scribble/text utilities scribble/text) -(provide (all-from-out "xml.rkt" "html.rkt" "resource.rkt" scribble/text)) +(provide (all-from-out "xml.rkt" "html.rkt" "resource.rkt" scribble/text) + (rename-out [top #%top])) + +(require (for-syntax racket/base)) +(define-syntax (top stx) + (syntax-case stx () + [(_ . x) + (let ([x* (syntax-e #'x)]) + (if (and (symbol? x*) (regexp-match? #rx":$" (symbol->string x*))) + #''x + #'(#%top . x)))])) From d6b3461aad1940c2370243bce3b3b14bc24fdece Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 31 Oct 2010 07:07:57 -0600 Subject: [PATCH 38/54] add `codeblock' to Scribble original commit: aa7c4b53d9c2962536b3a37bb244600d7216289e --- collects/scribble/manual.rkt | 2 + collects/scribble/private/manual-code.rkt | 194 ++++++++++++++++++ .../scribblings/scribble/how-to-paper.scrbl | 30 +-- collects/scribblings/scribble/manual.scrbl | 54 +++++ 4 files changed, 268 insertions(+), 12 deletions(-) create mode 100644 collects/scribble/private/manual-code.rkt diff --git a/collects/scribble/manual.rkt b/collects/scribble/manual.rkt index d84a5bf7..7266ff51 100644 --- a/collects/scribble/manual.rkt +++ b/collects/scribble/manual.rkt @@ -2,6 +2,7 @@ (require "base.ss" "private/manual-style.ss" "private/manual-scheme.ss" + "private/manual-code.ss" "private/manual-mod.ss" "private/manual-tech.ss" "private/manual-bib.ss" @@ -18,6 +19,7 @@ (all-from-out "base.ss" "private/manual-style.ss" "private/manual-scheme.ss" + "private/manual-code.ss" "private/manual-mod.ss" "private/manual-tech.ss" "private/manual-bib.ss" diff --git a/collects/scribble/private/manual-code.rkt b/collects/scribble/private/manual-code.rkt new file mode 100644 index 00000000..e78d7d48 --- /dev/null +++ b/collects/scribble/private/manual-code.rkt @@ -0,0 +1,194 @@ +#lang racket/base +(require syntax/strip-context + syntax-color/module-lexer + "../racket.rkt" + "../core.rkt" + "../base.rkt" + "manual-scheme.rkt" + (for-syntax racket/base + syntax/parse)) + +(provide codeblock + typeset-code) + +(define-syntax (codeblock stx) + (syntax-parse stx + [(_ (~seq (~or (~optional (~seq #:expand expand-expr:expr) + #:defaults ([expand-expr #'#f]) + #:name "#:expand keyword") + (~optional (~seq #:indent indent-expr:expr) + #:defaults ([indent-expr #'2]) + #:name "#:expand keyword") + (~optional (~seq #:keep-lang-line? keep-lang-line?-expr:expr) + #:defaults ([keep-lang-line?-expr #'#t]) + #:name "#:keep-lang-line? keyword") + (~optional (~seq #:context context-expr:expr) + #:name "#:context keyword")) + ...) + str ...) + #`(typeset-code str ... + #:expand expand-expr + #:keep-lang-line? keep-lang-line?-expr + #:indent indent-expr + #:context #,(if (attribute context-expr) + #'context-expr + (or + (let ([v #'(str ...)]) + (and (pair? (syntax-e v)) + #`#'#,(car (syntax-e v)))) + #'#f)))])) + +(define (typeset-code #:context [context #f] + #:expand [expand #f] + #:indent [indent 2] + #:keep-lang-line? [keep-lang-line? #t] + . strs) + (let* ([str (apply string-append strs)] + [bstr (string->bytes/utf-8 (regexp-replace* #rx"(?m:^$)" str "\xA0"))] + [in (open-input-bytes bstr)]) + (let* ([tokens + (let loop ([mode #f]) + (let-values ([(lexeme type data start end backup-delta mode) + (module-lexer in 0 mode)]) + (if (eof-object? lexeme) + null + (cons (list type (sub1 start) (sub1 end) 0) + (loop mode)))))] + [substring* (lambda (bstr start [end (bytes-length bstr)]) + (bytes->string/utf-8 (subbytes bstr start end)))] + [e (parameterize ([read-accept-reader #t]) + ((or expand + (lambda (stx) + (if context + (replace-context context stx) + stx))) + (read-syntax 'prog (open-input-bytes bstr))))] + [ids (let loop ([e e]) + (cond + [(and (identifier? e) + (syntax-original? e)) + (let ([pos (sub1 (syntax-position e))]) + (list (list (to-element e) + pos + (+ pos (syntax-span e)) + 1)))] + [(syntax? e) (append (loop (syntax-e e)) + (loop (or (syntax-property e 'origin) + null)) + (loop (or (syntax-property e 'disappeared-use) + null)))] + [(pair? e) (append (loop (car e)) (loop (cdr e)))] + [else null]))] + [link-mod (lambda (mp-stx priority #:orig? [always-orig? #f]) + (if (or always-orig? + (syntax-original? mp-stx)) + (let ([mp (syntax->datum mp-stx)] + [pos (sub1 (syntax-position mp-stx))]) + (list (list (racketmodname #,mp) + pos + (+ pos (syntax-span mp-stx)) + priority))) + null))] + ;; This makes sense when `expand' actually expands, and + ;; probably not otherwise: + [mods (let loop ([e e]) + (syntax-case e (module require begin) + [(module name lang (mod-beg form ...)) + (apply append + (link-mod #'lang 2) + (map loop (syntax->list #'(form ...))))] + [(#%require spec ...) + (apply append + (map (lambda (spec) + ;; Need to add support for renaming forms, etc.: + (if (module-path? (syntax->datum spec)) + (link-mod spec 2) + null)) + (syntax->list #'(spec ...))))] + [(begin form ...) + (apply append + (map loop (syntax->list #'(form ...))))] + [else null]))] + [language (if (regexp-match? #rx"^#lang " bstr) + (let ([m (regexp-match #rx"^#lang ([-a-zA-Z/._+]+)" bstr)]) + (if m + (link-mod + #:orig? #t + (datum->syntax #f + (string->symbol (bytes->string/utf-8 (cadr m))) + (vector 'in 1 6 7 (bytes-length (cadr m)))) + 3) + null)) + null)] + [tokens (sort (append ids + mods + language + (filter (lambda (x) (not (eq? (car x) 'symbol))) + ;; Drop #lang entry: + (cdr tokens))) + (lambda (a b) + (or (< (cadr a) (cadr b)) + (and (= (cadr a) (cadr b)) + (> (cadddr a) (cadddr b))))))] + [default-color meta-color]) + (table + block-color + ((if keep-lang-line? values cdr) ; FIXME: #lang can span lines + (list->lines + indent + (let loop ([pos 0] + [tokens tokens]) + (cond + [(null? tokens) (split-lines default-color (substring* bstr pos))] + [(eq? (caar tokens) 'white-space) (loop pos (cdr tokens))] + [(= pos (cadar tokens)) + (append (let ([style (caar tokens)]) + (if (symbol? style) + (let ([scribble-style + (case style + [(symbol) symbol-color] + [(parenthesis) paren-color] + [(constant string) value-color] + [(comment) comment-color] + [else default-color])]) + (split-lines scribble-style + (substring* bstr (cadar tokens) (caddar tokens)))) + (list (caar tokens)))) + (loop (caddar tokens) (cdr tokens)))] + [(> pos (cadar tokens)) + (loop pos (cdr tokens))] + [else (append + (split-lines default-color (substring* bstr pos (cadar tokens))) + (loop (cadar tokens) tokens))])))))))) + + +(define (split-lines style s) + (cond + [(regexp-match-positions #rx"(?:\r\n|\r|\n)" s) + => (lambda (m) + (list* (element style (substring s 0 (caar m))) + 'newline + (split-lines style (substring s (cdar m)))))] + [(regexp-match-positions #rx" +" s) + => (lambda (m) + (append (split-lines style (substring s 0 (caar m))) + (list (hspace (- (cdar m) (caar m)))) + (split-lines style (substring s (cdar m)))))] + [else (list (element style s))])) + +(define omitable (make-style #f '(omitable))) + +(define (list->lines indent-amt l) + (define (make-line accum-line) (list (paragraph omitable + (cons indent-elem + (reverse accum-line))))) + (define indent-elem (hspace indent-amt)) + (let loop ([l l] [accum-line null]) + (cond + [(null? l) (if (null? accum-line) + null + (list (make-line accum-line)))] + [(eq? 'newline (car l)) + (cons (make-line accum-line) + (loop (cdr l) null))] + [else (loop (cdr l) (cons (car l) accum-line))]))) diff --git a/collects/scribblings/scribble/how-to-paper.scrbl b/collects/scribblings/scribble/how-to-paper.scrbl index 6f32afa7..3bd44e62 100644 --- a/collects/scribblings/scribble/how-to-paper.scrbl +++ b/collects/scribblings/scribble/how-to-paper.scrbl @@ -2,9 +2,15 @@ @(require scribble/manual scribble/bnf "utils.ss" - (for-label scriblib/figure)) + (for-label scriblib/figure + scribble/base + scribble/sigplan)) -@(define (sample . text) (nested #:style 'inset (apply verbatim text))) +@(define-syntax-rule (samplemod . text) (codeblock . text)) +@(define-syntax-rule (sample a . text) (codeblock #:context #'a + #:keep-lang-line? #f + "#lang scribble/base" "\n" + a . text)) @(define (result . text) (apply nested #:style 'inset text)) @title[#:tag "getting-started"]{Getting Started} @@ -18,7 +24,7 @@ goal-specific advice on how to continue. Create a file @filepath{mouse.scrbl} with this content: - @sample|{ + @samplemod|{ #lang scribble/base @title{On the Cookie-Eating Habits of Mice} @@ -65,7 +71,7 @@ for the kind of document that you want as output: Add more text to @filepath{mouse.scrbl} so that it looks like this: - @sample|{ + @samplemod|{ #lang scribble/base @title{On the Cookie-Eating Habits of Mice} @@ -111,7 +117,7 @@ larger document. To split the example document into multiple files, change @filepath{mouse.scrbl} to just - @sample|{ + @samplemod|{ #lang scribble/base @title{On the Cookie-Eating Habits of Mice} @@ -126,7 +132,7 @@ To split the example document into multiple files, change Create @filepath{milk.scrbl} and @filepath{straw.scrbl} in the same directory as @filepath{mouse.scrbl}. In @filepath{milk.scrbl}, put - @sample|{ + @samplemod|{ #lang scribble/base @title{The Consequences of Milk} @@ -136,7 +142,7 @@ directory as @filepath{mouse.scrbl}. In @filepath{milk.scrbl}, put and in @filepath{straw.scbl}, put - @sample|{ + @samplemod|{ #lang scribble/base @title{Not the Last Straw} @@ -167,14 +173,14 @@ the paper to a workshop on programming languages, then---well, you probably need a different topic. But you can start making the current content look right by changing the first line to - @sample|{ + @samplemod|{ #lang scribble/sigplan }| If you're instead working toward Racket library documentation, try changing the first line to - @sample|{ + @samplemod|{ #lang scribble/manual }| @@ -191,7 +197,7 @@ version number---but it changes the set of bindings available in the document body. For example, with @racketmodname[scribble/sigplan], the introductory text can be marked as an abstract: - @sample|{ + @samplemod|{ #lang scribble/sigplan @title{On the Cookie-Eating Habits of Mice} @@ -573,9 +579,9 @@ renders as because the source is equivalent to - @sample|{ + @racketblock[ (verbatim (number->string (+ 1 2))) - }| + ] where @racket[(number->string (+ 1 2))] is evaluated to produce the argument to @racket[verbatim]. The @litchar["|{"]...@litchar["}|"] diff --git a/collects/scribblings/scribble/manual.scrbl b/collects/scribblings/scribble/manual.scrbl index ad635fe3..d137e325 100644 --- a/collects/scribblings/scribble/manual.scrbl +++ b/collects/scribblings/scribble/manual.scrbl @@ -30,6 +30,60 @@ includes a @racket[latex-defaults] @tech{style property}. @; ------------------------------------------------------------------------ @section[#:tag "scribble:manual:code"]{Typesetting Code} +@defform/subs[(codeblock option ... str-expr ...+) + ([option (code:line #:indent indent-expr) + (code:line #:expand expand-expr) + (code:line #:context context-expr) + (code:line #:keep-lang-line? keep-expr)]) + #:contracts ([indent-expr exact-nonnegative-integer?] + [expand-expr (or/c #f (syntax-object? . -> . syntax-object?))] + [context-expr syntax-object?] + [keep-expr any/c])]{ + +Parses the code formed by the strings produced by the +@racket[str-expr]s as a Racket module and produces a @tech{block} that +typesets the code. The code is indented by the amount specified by +@racket[indent-expr], which defaults to @racket[2]. + +When @racket[expand-expr] produces @racket[#f] (which is the default), +identifiers in the typeset code are colored and linked based on +for-label bindings in the lexical environment of the syntax object +provided by @racket[context-expr]. The default @racket[context-expr] +has the same lexical context as the first @racket[str-expr]. + +When @racket[expand-expr] produces a procedure, it is used to +macro-expand the parsed program, and syntax coloring is based on the +parsed program. + +When @racket[keep-lang-line?-expr] produces a true value (the +default), the @hash-lang[] line in the input is preserved in the +typeset output, otherwise the first line is dropped. + +For example, + +@codeblock[#:keep-lang-line? #f]|<|{ + #lang scribble/manual + @codeblock|{ + #lang scribble/manual + @codeblock{ + #lang scribble/manual + @title{Hello} + } + }| +}|>| + +produces the typeset result + + @codeblock|{ + #lang scribble/manual + @codeblock{ + #lang scribble/manual + @title{Hello} + } + }| + +} + @defform[(racketblock datum ...)]{ Typesets the @racket[datum] sequence as a table of Racket code inset From 6c09eb6bdfb30c8452db2799664f275ec11d6014 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Fri, 29 Oct 2010 10:59:33 -0400 Subject: [PATCH 39/54] The reader for "#lang scribble/html". (Somehow wasn't included in the earlier commit.) original commit: 4d11d12c40eeb318d9986b233472c1b263368d54 --- collects/scribble/html/lang/reader.rkt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 collects/scribble/html/lang/reader.rkt diff --git a/collects/scribble/html/lang/reader.rkt b/collects/scribble/html/lang/reader.rkt new file mode 100644 index 00000000..b61bd509 --- /dev/null +++ b/collects/scribble/html/lang/reader.rkt @@ -0,0 +1,11 @@ +#lang s-exp syntax/module-reader + +scribble/html/lang + +#:read scribble:read-inside +#:read-syntax scribble:read-syntax-inside +#:whole-body-readers? #t +#:info (scribble-base-reader-info) + +(require (prefix-in scribble: scribble/reader) + (only-in scribble/base/reader scribble-base-reader-info)) From f52f97fe09e2fd03c17971929889a44f32b42d0c Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 31 May 2010 15:18:42 -0600 Subject: [PATCH 40/54] C source and build changes to drop wx frm GRacket original commit: a574d9e7e4bcfd4a7fae2a3654e81c9babb46914 --- src/mac/cw/MrStarter.r | 196 ----------------------------------------- 1 file changed, 196 deletions(-) diff --git a/src/mac/cw/MrStarter.r b/src/mac/cw/MrStarter.r index 1d721814..e69de29b 100644 --- a/src/mac/cw/MrStarter.r +++ b/src/mac/cw/MrStarter.r @@ -1,196 +0,0 @@ -data 'BNDL' (128) { - $"4D72 5374 0000 0001 4652 4546 0001 0000" /* MrSt....FREF.... */ - $"0080 0001 0081 4943 4E23 0001 0000 0082" /* .€...ICN#.....‚ */ - $"0001 0000" /* .... */ -}; - -data 'cmdl' (128) { - $"2D65 2027 2864 6973 706C 6179 2022 6869" /* -e '(display "hi */ - $"2229 27" /* ")' */ -}; - -data 'ALRT' (128) { - $"0065 0054 00EF 0184 0080 5555 300A" /* .e.T.ï.„.€UU0 */ -}; - -data 'DITL' (128) { - $"0002 0000 0000 006C 0089 0080 00C3 0402" /* .......l.‰.€.Ã.. */ - $"4F4B 0000 0000 0007 000C 0039 0122 8802" /* OK.........9."ˆ. */ - $"5E30 0000 0000 003A 000C 0064 0122 8802" /* ^0.....:...d."ˆ. */ - $"5E31" /* ^1 */ -}; - -data 'icl8' (130) { - $"0000 0000 0000 0000 0000 0000 00F5 2BF7" /* .............õ+÷ */ - $"F7F7 F500 0000 0000 0000 0000 0000 0000" /* ÷÷õ............. */ - $"0000 0000 0000 0000 0000 F8FB F2F1 D4EB" /* ..........øûòñÔë */ - $"ECD3 EEAA 802B 0000 0000 0000 0000 0000" /* ìÓ+.......... */ - $"0000 0000 0000 0000 56FB FAF7 F5F5 F7AB" /* ........Vûú÷õõ÷« */ - $"D2D2 D2D2 D2D3 AAF7 0000 0000 0000 0000" /* ÒÒÒÒÒÓª÷........ */ - $"0000 0000 0000 F688 885D 6464 F900 00F5" /* ......öˆˆ]ddù..õ */ - $"AAD2 D2D2 D2D2 D2D3 FBF5 0000 0000 0000" /* ªÒÒÒÒÒÒÓûõ...... */ - $"0000 0000 00F7 6B23 2323 2323 D9F7 0000" /* .....÷k#####Ù÷.. */ - $"F7D3 D2D2 D2D2 D2D2 D2AA F600 0000 0000" /* ÷ÓÒÒÒÒÒÒÒªö..... */ - $"0000 0000 F7DA 2323 2323 2323 23DB 0000" /* ....÷Ú#######Û.. */ - $"00AA D2D2 D2D2 D2D2 D2D2 D4F6 0000 0000" /* .ªÒÒÒÒÒÒÒÒÔö.... */ - $"0000 00F6 6B23 2323 2323 2323 23D8 F800" /* ...ök########Øø. */ - $"00F9 D2D2 D2D2 D2D2 D2D2 D2AB 0000 0000" /* .ùÒÒÒÒÒÒÒÒÒ«.... */ - $"0000 0088 2323 2323 2323 2323 2323 6400" /* ...ˆ##########d. */ - $"00F6 EED2 D2D2 D2D2 D2D2 D2D2 8000 0000" /* .öîÒÒÒÒÒÒÒÒÒ€... */ - $"0000 56D8 2323 2323 2323 2323 2323 6B00" /* ..VØ##########k. */ - $"0000 AAD2 D2D2 D2D2 D2D2 D2D2 D32B 0000" /* ..ªÒÒÒÒÒÒÒÒÒÓ+.. */ - $"0000 DB23 2323 2323 2323 2323 2323 472B" /* ..Û###########G+ */ - $"0000 F9D2 D2D2 D2D2 D2D2 D2D2 D2AA 0000" /* ..ùÒÒÒÒÒÒÒÒÒÒª.. */ - $"00F8 D723 2323 2323 2323 2323 2323 D7F8" /* .ø×###########×ø */ - $"0000 F6EE D2D2 D2D2 D2D2 D2D2 D2ED 2B00" /* ..öîÒÒÒÒÒÒÒÒÒí+. */ - $"0064 2323 2323 2323 2323 2323 2323 D7F8" /* .d############×ø */ - $"0000 00AA D2D2 D2D2 D2D2 D2D2 D2D2 FA00" /* ...ªÒÒÒÒÒÒÒÒÒÒú. */ - $"006B 2323 2323 2323 2323 2323 2323 D9F6" /* .k############Ùö */ - $"0000 00F8 ECD2 D2D2 D2D2 D2D2 D2D2 AA00" /* ...øìÒÒÒÒÒÒÒÒÒª. */ - $"F6D9 2323 2323 2323 2323 2323 2323 DB00" /* öÙ############Û. */ - $"F600 0000 D4D2 D2D2 D2D2 D2D2 D2D2 D400" /* ö...ÔÒÒÒÒÒÒÒÒÒÔ. */ - $"F7D7 2323 2323 2323 2323 2323 2323 FA5D" /* ÷×############ú] */ - $"DBF6 0000 FAD2 D2D2 D2D2 D2D2 D2D2 EDF6" /* Ûö..úÒÒÒÒÒÒÒÒÒíö */ - $"56D7 2323 2323 2323 2323 2323 23DA 2B6B" /* V×###########Ú+k */ - $"235D 0000 F6ED D2D2 D2D2 D2D2 D2D2 D32B" /* #]..öíÒÒÒÒÒÒÒÒÓ+ */ - $"56D7 2323 2323 2323 2323 2323 235D F9D7" /* V×###########]ù× */ - $"236B F500 00AA D2D2 D2D2 D2D2 D2D2 D32B" /* #kõ..ªÒÒÒÒÒÒÒÒÓ+ */ - $"F7D8 2323 2323 2323 2323 2323 6BF6 6423" /* ÷Ø##########köd# */ - $"2323 F900 00F8 EBD2 D2D2 D2D2 D2D2 EEF5" /* ##ù..øëÒÒÒÒÒÒÒîõ */ - $"F6D9 2323 2323 2323 2323 23D7 FAF8 D823" /* öÙ#########×úøØ# */ - $"2323 6400 0000 EFD2 D2D2 D2D2 D2D2 D400" /* ##d...ïÒÒÒÒÒÒÒÔ. */ - $"006B 2323 2323 2323 2323 23DB 0064 2323" /* .k#########Û.d## */ - $"2323 47F7 0000 F9EB D2D2 D2D2 D2D2 AA00" /* ##G÷..ùëÒÒÒÒÒÒª. */ - $"0064 2323 2323 2323 2323 D856 F6DA 2323" /* .d########ØVöÚ## */ - $"2323 235D 0000 00D4 D2D2 D2D2 D2D2 8000" /* ###]...ÔÒÒÒÒÒÒ€. */ - $"00F8 D823 2323 2323 2323 6400 5D23 2323" /* .øØ#######d.]### */ - $"2323 236B F500 00F9 EBD2 D2D2 D2ED 2B00" /* ###kõ..ùëÒÒÒÒí+. */ - $"0000 DB23 2323 2323 2347 F7F5 6B23 2323" /* ..Û######G÷õk### */ - $"2323 23D7 5600 00F5 D4D2 D2D2 D2AB 0000" /* ###×V..õÔÒÒÒÒ«.. */ - $"0000 56D8 2323 2323 2388 00F9 D723 2323" /* ..VØ#####ˆ.ù×### */ - $"2323 2323 6400 0000 F9EB E3E3 ED2B 0000" /* ####d...ùëããí+.. */ - $"0000 0088 2323 2323 DA2B 0064 2323 2323" /* ...ˆ####Ú+.d#### */ - $"2323 2323 D9F6 0000 F5EF E3CB E300 0000" /* ####Ùö..õïãËã... */ - $"0000 00F6 6B23 2323 5D00 F7D8 2323 2323" /* ...ök###].÷Ø#### */ - $"2323 2323 23E3 E3E3 E3E3 E3CB CBE3 0000" /* #####ããããããËËã.. */ - $"0000 0000 F7DA 236B F500 6423 2323 2323" /* ....÷Ú#kõ.d##### */ - $"2323 2323 23E3 CBCB CBCB CBCB CBCB E300" /* #####ãËËËËËËËËã. */ - $"0000 0000 00F7 DB56 00F7 D923 2323 2323" /* .....÷ÛV.÷Ù##### */ - $"2323 2323 23E3 CBCB CBCB CBCB CBCB CBE3" /* #####ãËËËËËËËËËã */ - $"0000 0000 0000 F6FC 8FD9 2323 2323 2323" /* ......öüÙ###### */ - $"2323 2323 23E3 CBCB CBCB CBCB CBCB E300" /* #####ãËËËËËËËËã. */ - $"0000 0000 0000 0000 F864 4723 2323 2323" /* ........ødG##### */ - $"2323 2323 23E3 E3E3 E3E3 E3CB CBE3 0000" /* #####ããããããËËã.. */ - $"0000 0000 0000 0000 0000 F75D DBDA 47D7" /* ..........÷]ÛÚG× */ - $"D747 6B64 5D2B 0000 0000 E3CB E300 0000" /* ×Gkd]+....ãËã... */ - $"0000 0000 0000 0000 0000 0000 00F5 2B2B" /* .............õ++ */ - $"2B2B 0000 0000 0000 0000 E3E3 0000 0000" /* ++........ãã.... */ -}; - -data 'icl4' (130) { - $"0000 0000 0000 00CC CC00 0000 0000 0000" /* .......ÌÌ....... */ - $"0000 0000 00CE FF66 6665 DC00 0000 0000" /* .....ÎÿffeÜ..... */ - $"0000 0000 DEDC 00CE 6666 665C 0000 0000" /* ....ÞÜ.Îfff\.... */ - $"0000 00CE EBBB D000 5666 6666 E000 0000" /* ...Îë»Ð.Vfffà... */ - $"0000 0C33 3333 3C00 C666 6666 65C0 0000" /* ...333<.ÆfffeÀ.. */ - $"0000 C333 3333 3300 0566 6666 666C 0000" /* ..Ã3333..ffffl.. */ - $"000C 3333 3333 33C0 0D66 6666 666E 0000" /* ..33333À.ffffn.. */ - $"000E 3333 3333 33B0 0C66 6666 6666 D000" /* ..33333°.fffffÐ. */ - $"00D3 3333 3333 3330 0056 6666 6666 6C00" /* .Ó333330.Vffffl. */ - $"0033 3333 3333 333C 00D6 6666 6666 6500" /* .333333<.Öffffe. */ - $"0C33 3333 3333 333C 00C6 6666 6666 66C0" /* .333333<.ÆfffffÀ */ - $"0B33 3333 3333 333C 0005 6666 6666 66D0" /* .333333<..fffffÐ */ - $"0333 3333 3333 333C 000C 6666 6666 6650" /* .333333<..fffffP */ - $"C333 3333 3333 3330 C000 6666 6666 6660" /* Ã3333330À.fffff` */ - $"C333 3333 3333 33DB 3C00 D666 6666 666C" /* Ã333333Û<.Öffffl */ - $"D333 3333 3333 33C3 3B00 C666 6666 666C" /* Ó333333Ã;.Æffffl */ - $"D333 3333 3333 3BD3 3300 0566 6666 666C" /* Ó33333;Ó3..ffffl */ - $"C333 3333 3333 3CB3 33D0 0C66 6666 6660" /* Ã33333<³3Ð.ffff` */ - $"C333 3333 3333 DC33 33B0 0066 6666 6660" /* Ã33333Ü33°.ffff` */ - $"0333 3333 3333 0B33 333C 00D6 6666 6650" /* .33333.33<.ÖfffP */ - $"0B33 3333 333D C333 333B 0006 6666 66D0" /* .3333=Ã33;..fffÐ */ - $"0C33 3333 33B0 B333 3333 000D 6666 66C0" /* .3333°³333..fffÀ */ - $"0033 3333 33C0 3333 3333 D000 6666 6E00" /* .3333À3333Ð.ffn. */ - $"00D3 3333 3E0D 3333 3333 B000 D688 6C00" /* .Ó33>.3333°.Öˆl. */ - $"000E 3333 3C0B 3333 3333 3C00 0689 8000" /* ..33<.3333<..‰€. */ - $"000C 3333 B0C3 3333 3333 3888 8889 9800" /* ..33°Ã33338ˆˆ‰˜. */ - $"0000 C333 00B3 3333 3333 3899 9999 9980" /* ..Ã3.³33338™™™™€ */ - $"0000 0C3D 0C33 3333 3333 3899 9999 9998" /* ...=.333338™™™™˜ */ - $"0000 00CE A333 3333 3333 3899 9999 9980" /* ...Σ333338™™™™€ */ - $"0000 0000 CB33 3333 3333 3888 8889 9800" /* ....Ë333338ˆˆ‰˜. */ - $"0000 0000 00CB 3333 333B BC00 0089 8000" /* .....Ë333;¼..‰€. */ - $"0000 0000 0000 00CC CC00 0000 0088 0000" /* .......ÌÌ....ˆ.. */ -}; - -data 'ICN#' (130) { - $"001F F800 0075 5600 01FE AB80 0341 5540" /* ..ø..uV..þ«€.AU@ */ - $"06B8 AAA0 0D54 D550 1AAC 6AA8 3556 5554" /* .¸ª .TÕP.¬j¨5VUT */ - $"2AAA 2AAC 5555 3556 6AAB 1AAA D555 1555" /* *ª*¬UU5Vj«.ªÕU.U */ - $"AAAB 0AAB D555 0D55 AAAA 46AB D556 C555" /* ª«Â«ÕU.UªªF«ÕVÅU */ - $"AAAC A2AB D555 6355 AAA9 A1AB D55B 5155" /* ª¬¢«ÕUcUª©¡«Õ[QU */ - $"AAB2 B0AB 5555 58D6 6AA6 A86A 356D 547C" /* ª²°«UUXÖj¦¨j5mT| */ - $"2ACA AC2C 1555 57E4 0A9A AC02 05B5 5401" /* *ʬ,.UW䚬..µT. */ - $"03EA AC02 01D5 57E4 006A AB28 001F FC30" /* .ê¬..ÕWä.j«(..ü0 */ - $"001F F800 007F FE00 01FF FF80 03FF FFC0" /* ..ø...þ..ÿÿ€.ÿÿÀ */ - $"07FF FFE0 0FFF FFF0 1FFF FFF8 3FFF FFFC" /* .ÿÿà.ÿÿð.ÿÿø?ÿÿü */ - $"3FFF FFFC 7FFF FFFE 7FFF FFFE FFFF FFFF" /* ?ÿÿü.ÿÿþ.ÿÿþÿÿÿÿ */ - $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" /* ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ */ - $"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF" /* ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ */ - $"FFFF FFFF 7FFF FFFE 7FFF FFFE 3FFF FFFC" /* ÿÿÿÿ.ÿÿþ.ÿÿþ?ÿÿü */ - $"3FFF FFFC 1FFF FFFC 0FFF FFFE 07FF FFFF" /* ?ÿÿü.ÿÿü.ÿÿþ.ÿÿÿ */ - $"03FF FFFE 01FF FFFC 007F FF38 001F FC30" /* .ÿÿþ.ÿÿü..ÿ8..ü0 */ -}; - -data 'ics#' (130) { - $"07E0 1FF8 39FC 7EFE 7E7E FF7F FF3F FE3F" /* .à.ø9ü~þ~~ÿ.ÿ?þ? */ - $"FC9F FDDF F9CF 7BEE 73FA 37E1 1FFA 07E4" /* üŸýßùÏ{îsú7á.ú.ä */ - $"07E0 1FF8 3FFC 7FFE 7FFE FFFF FFFF FFFF" /* .à.ø?ü.þ.þÿÿÿÿÿÿ */ - $"FFFF FFFF FFFF 7FFE 7FFE 3FFF 1FFE 07E4" /* ÿÿÿÿÿÿ.þ.þ?ÿ.þ.ä */ -}; - -data 'ics4' (130) { - $"0000 0FFF FFF0 0000 000F F666 666F F000" /* ...ÿÿð....öffoð. */ - $"00F3 3006 6666 6F00 0F33 3330 6666 66F0" /* .ó0.ffo..330fffð */ - $"0F33 3330 0666 66F0 F333 3333 0666 666F" /* .330.ffðó333.ffo */ - $"F333 3333 0066 666F F333 3330 0066 666F" /* ó333.ffoó330.ffo */ - $"F333 3300 3006 666F F333 3303 3306 666F" /* ó33.0.foó33.3.fo */ - $"F333 3003 3300 666F 0F33 3033 3330 68F0" /* ó30.3.fo.30330hð */ - $"0F33 0033 3388 8980 00F3 0333 3389 9998" /* .3.33ˆ‰€.ó.33‰™˜ */ - $"000F F333 3388 8980 0000 0FFF FFF0 0800" /* ..ó33ˆ‰€...ÿÿð.. */ -}; - -data 'ics8' (130) { - $"0000 0000 00FF FFFF FFFF FF00 0000 0000" /* .....ÿÿÿÿÿÿ..... */ - $"0000 00FF FFD2 D2D2 D2D2 D2FF FF00 0000" /* ...ÿÿÒÒÒÒÒÒÿÿ... */ - $"0000 FF23 2300 00D2 D2D2 D2D2 D2FF 0000" /* ..ÿ##..ÒÒÒÒÒÒÿ.. */ - $"00FF 2323 2323 2300 D2D2 D2D2 D2D2 FF00" /* .ÿ#####.ÒÒÒÒÒÒÿ. */ - $"00FF 2323 2323 2300 00D2 D2D2 D2D2 FF00" /* .ÿ#####..ÒÒÒÒÒÿ. */ - $"FF23 2323 2323 2323 00D2 D2D2 D2D2 D2FF" /* ÿ#######.ÒÒÒÒÒÒÿ */ - $"FF23 2323 2323 2323 0000 D2D2 D2D2 D2FF" /* ÿ#######..ÒÒÒÒÒÿ */ - $"FF23 2323 2323 2300 0000 D2D2 D2D2 D2FF" /* ÿ######...ÒÒÒÒÒÿ */ - $"FF23 2323 2323 0000 2300 00D2 D2D2 D2FF" /* ÿ#####..#..ÒÒÒÒÿ */ - $"FF23 2323 2323 0023 2323 00D2 D2D2 D2FF" /* ÿ#####.###.ÒÒÒÒÿ */ - $"FF23 2323 2300 0023 2323 0000 D2D2 D2FF" /* ÿ####..###..ÒÒÒÿ */ - $"00FF 2323 2300 2323 2323 2300 ECE3 FF00" /* .ÿ###.#####.ìãÿ. */ - $"00FF 2323 0000 2323 2323 E3E3 E3CB E300" /* .ÿ##..####ãããËã. */ - $"0000 FF23 0023 2323 2323 E3CB CBCB CBE3" /* ..ÿ#.#####ãËËËËã */ - $"0000 00FF FF23 2323 2323 E3E3 E3CB E300" /* ...ÿÿ#####ãããËã. */ - $"0000 0000 00FF FFFF FFFF FF00 00E3 0000" /* .....ÿÿÿÿÿÿ..ã.. */ -}; - -data 'MrSt' (0, "Owner resource") { - $"00" /* . */ -}; - -data 'FREF' (128) { - $"4150 504C 0000 00" /* APPL... */ -}; - -data 'FREF' (129) { - $"2A2A 2A2A 0001 00" /* ****... */ -}; - -data 'SIZE' (-1) { - $"58F0 0007 A120 0007 A120" /* Xð..¡ ..¡ */ -}; - From 98426520a89cee46adb4d468b6a2c366955d6fe1 Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Tue, 16 Nov 2010 12:35:10 -0500 Subject: [PATCH 41/54] Updated version of sigplanconf.cls original commit: 7b612090698a07aadff573a09a4de8ab861ab708 --- collects/scribble/sigplan/sigplanconf.cls | 928 +++++++++++----------- 1 file changed, 455 insertions(+), 473 deletions(-) diff --git a/collects/scribble/sigplan/sigplanconf.cls b/collects/scribble/sigplan/sigplanconf.cls index a5891f75..318a5b6a 100644 --- a/collects/scribble/sigplan/sigplanconf.cls +++ b/collects/scribble/sigplan/sigplanconf.cls @@ -20,18 +20,18 @@ \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesClass{sigplanconf}[2009/04/29 v1.9 ACM SIGPLAN Proceedings] +\ProvidesClass{sigplanconf}[2007/03/13 v1.5 ACM SIGPLAN Proceedings] % The following few pages contain LaTeX programming extensions adapted % from the ZzTeX macro package. - + % Token Hackery % ----- ------- \def \@expandaftertwice {\expandafter\expandafter\expandafter} \def \@expandafterthrice {\expandafter\expandafter\expandafter\expandafter - \expandafter\expandafter\expandafter} + \expandafter\expandafter\expandafter} % This macro discards the next token. @@ -49,17 +49,17 @@ % Usage: \expandafter\@defof \meaning\macro\@mark \def \@defof #1:->#2\@mark{#2} - + % Control Sequence Names % ------- -------- ----- \def \@name #1{% {\tokens} - \csname \expandafter\@discardtok \string#1\endcsname} + \csname \expandafter\@discardtok \string#1\endcsname} \def \@withname #1#2{% {\command}{\tokens} - \expandafter#1\csname \expandafter\@discardtok \string#2\endcsname} - + \expandafter#1\csname \expandafter\@discardtok \string#2\endcsname} + % Flags (Booleans) % ----- ---------- @@ -70,7 +70,7 @@ \def \@false {FL} \def \@setflag #1=#2{\edef #1{#2}}% \flag = boolean - + % IF and Predicates % -- --- ---------- @@ -99,7 +99,7 @@ \def \@oddp #1{\ifodd #1\@true \else \@false \fi} \def \@evenp #1{\ifodd #1\@false \else \@true \fi} \def \@rangep #1#2#3{\if \@orp{\@lssp{#1}{#2}}{\@gtrp{#1}{#3}}\@false \else - \@true \fi} + \@true \fi} \def \@tensp #1{\@rangep{#1}{10}{19}} \def \@dimeqlp #1#2{\ifdim #1 = #2\@true \else \@false \fi} @@ -124,25 +124,25 @@ \long\def \@xtokeqlp #1#2{\expandafter\ifx #1#2\@true \else \@false \fi} \long\def \@definedp #1{% - \expandafter\ifx \csname \expandafter\@discardtok \string#1\endcsname - \relax \@false \else \@true \fi} + \expandafter\ifx \csname \expandafter\@discardtok \string#1\endcsname + \relax \@false \else \@true \fi} \long\def \@undefinedp #1{% - \expandafter\ifx \csname \expandafter\@discardtok \string#1\endcsname - \relax \@true \else \@false \fi} + \expandafter\ifx \csname \expandafter\@discardtok \string#1\endcsname + \relax \@true \else \@false \fi} \def \@emptydefp #1{\ifx #1\@empty \@true \else \@false \fi}% {\name} \let \@emptylistp = \@emptydefp \long\def \@emptyargp #1{% {#n} - \@empargp #1\@empargq\@mark} + \@empargp #1\@empargq\@mark} \long\def \@empargp #1#2\@mark{% - \ifx #1\@empargq \@true \else \@false \fi} + \ifx #1\@empargq \@true \else \@false \fi} \def \@empargq {\@empargq} \def \@emptytoksp #1{% {\tokenreg} - \expandafter\@emptoksp \the#1\@mark} + \expandafter\@emptoksp \the#1\@mark} \long\def \@emptoksp #1\@mark{\@emptyargp{#1}} @@ -163,30 +163,30 @@ \def \@notp #1{\if #1\@false \else \@true \fi} \def \@andp #1#2{\if #1% - \if #2\@true \else \@false \fi - \else - \@false - \fi} + \if #2\@true \else \@false \fi + \else + \@false + \fi} \def \@orp #1#2{\if #1% - \@true - \else - \if #2\@true \else \@false \fi - \fi} - -\def \@xorp #1#2{\if #1% - \if #2\@false \else \@true \fi + \@true \else \if #2\@true \else \@false \fi \fi} +\def \@xorp #1#2{\if #1% + \if #2\@false \else \@true \fi + \else + \if #2\@true \else \@false \fi + \fi} + % Arithmetic % ---------- \def \@increment #1{\advance #1 by 1\relax}% {\count} \def \@decrement #1{\advance #1 by -1\relax}% {\count} - + % Options % ------- @@ -207,16 +207,16 @@ % Note that all the dangerous article class options are trapped. \DeclareOption{9pt}{\@setflag \@ninepoint = \@true - \@setflag \@explicitsize = \@true} + \@setflag \@explicitsize = \@true} \DeclareOption{10pt}{\PassOptionsToClass{10pt}{article}% - \@setflag \@ninepoint = \@false - \@setflag \@tenpoint = \@true - \@setflag \@explicitsize = \@true} + \@setflag \@ninepoint = \@false + \@setflag \@tenpoint = \@true + \@setflag \@explicitsize = \@true} \DeclareOption{11pt}{\PassOptionsToClass{11pt}{article}% - \@setflag \@ninepoint = \@false - \@setflag \@explicitsize = \@true} + \@setflag \@ninepoint = \@false + \@setflag \@explicitsize = \@true} \DeclareOption{12pt}{\@unsupportedoption{12pt}} @@ -252,7 +252,7 @@ \DeclareOption{numberedpars}{\@numheaddepth = 4} -%%%\DeclareOption{onecolumn}{\@setflag \@onecolumn = \@true} +\DeclareOption{onecolumn}{\@setflag \@onecolumn = \@true} \DeclareOption{preprint}{\@setflag \@preprint = \@true} @@ -271,34 +271,34 @@ \ProcessOptions \if \@onecolumn - \if \@notp{\@explicitsize}% - \@setflag \@ninepoint = \@false - \PassOptionsToClass{11pt}{article}% - \fi - \PassOptionsToClass{twoside,onecolumn}{article} + \if \@notp{\@explicitsize}% + \@setflag \@ninepoint = \@false + \PassOptionsToClass{11pt}{article}% + \fi + \PassOptionsToClass{twoside,onecolumn}{article} \else - \PassOptionsToClass{twoside,twocolumn}{article} + \PassOptionsToClass{twoside,twocolumn}{article} \fi \LoadClass{article} \def \@unsupportedoption #1{% - \ClassError{proc}{The standard '#1' option is not supported.}} + \ClassError{proc}{The standard '#1' option is not supported.}} % This can be used with the 'reprint' option to get the final folios. \def \setpagenumber #1{% - \setcounter{page}{#1}} + \setcounter{page}{#1}} \AtEndDocument{\label{sigplanconf@finalpage}} - + % Utilities % --------- \newcommand{\setvspace}[2]{% - #1 = #2 - \advance #1 by -1\parskip} - + #1 = #2 + \advance #1 by -1\parskip} + % Document Parameters % -------- ---------- @@ -313,11 +313,11 @@ \setlength{\headsep}{0pt} \if \@onecolumn - \setlength{\evensidemargin}{.75in} - \setlength{\oddsidemargin}{.75in} + \setlength{\evensidemargin}{.75in} + \setlength{\oddsidemargin}{.75in} \else - \setlength{\evensidemargin}{.75in} - \setlength{\oddsidemargin}{.75in} + \setlength{\evensidemargin}{.75in} + \setlength{\oddsidemargin}{.75in} \fi % Text area: @@ -326,9 +326,9 @@ \setlength{\standardtextwidth}{42pc} \if \@onecolumn - \setlength{\textwidth}{40.5pc} + \setlength{\textwidth}{20pc} \else - \setlength{\textwidth}{\standardtextwidth} + \setlength{\textwidth}{\standardtextwidth} \fi \setlength{\topskip}{8pt} @@ -342,11 +342,11 @@ % Paragraphs: \if \@blockstyle - \setlength{\parskip}{5pt plus .1pt minus .5pt} - \setlength{\parindent}{0pt} + \setlength{\parskip}{5pt plus .1pt minus .5pt} + \setlength{\parindent}{0pt} \else - \setlength{\parskip}{0pt} - \setlength{\parindent}{12pt} + \setlength{\parskip}{0pt} + \setlength{\parindent}{12pt} \fi \setlength{\lineskip}{.5pt} @@ -376,10 +376,10 @@ \setlength{\footnotesep}{9pt} \renewcommand{\footnoterule}{% - \hrule width .5\columnwidth height .33pt depth 0pt} + \hrule width .5\columnwidth height .33pt depth 0pt} \renewcommand{\@makefntext}[1]{% - \noindent \@makefnmark \hspace{1pt}#1} + \noindent \@makefnmark \hspace{1pt}#1} % Floats: @@ -409,48 +409,48 @@ % Miscellaneous: \errorcontextlines = 5 - + % Fonts % ----- \if \@times - \renewcommand{\rmdefault}{ptm}% - \if \@mathtime - \usepackage[mtbold,noTS1]{mathtime}% - \else + \renewcommand{\rmdefault}{ptm}% + \if \@mathtime + \usepackage[mtbold,noTS1]{mathtime}% + \else %%% \usepackage{mathptm}% - \fi + \fi \else - \relax + \relax \fi \if \@ninepoint \renewcommand{\normalsize}{% - \@setfontsize{\normalsize}{9pt}{10pt}% - \setlength{\abovedisplayskip}{5pt plus 1pt minus .5pt}% - \setlength{\belowdisplayskip}{\abovedisplayskip}% - \setlength{\abovedisplayshortskip}{3pt plus 1pt minus 2pt}% - \setlength{\belowdisplayshortskip}{\abovedisplayshortskip}} + \@setfontsize{\normalsize}{9pt}{10pt}% + \setlength{\abovedisplayskip}{5pt plus 1pt minus .5pt}% + \setlength{\belowdisplayskip}{\abovedisplayskip}% + \setlength{\abovedisplayshortskip}{3pt plus 1pt minus 2pt}% + \setlength{\belowdisplayshortskip}{\abovedisplayshortskip}} \renewcommand{\tiny}{\@setfontsize{\tiny}{5pt}{6pt}} \renewcommand{\scriptsize}{\@setfontsize{\scriptsize}{7pt}{8pt}} \renewcommand{\small}{% - \@setfontsize{\small}{8pt}{9pt}% - \setlength{\abovedisplayskip}{4pt plus 1pt minus 1pt}% - \setlength{\belowdisplayskip}{\abovedisplayskip}% - \setlength{\abovedisplayshortskip}{2pt plus 1pt}% - \setlength{\belowdisplayshortskip}{\abovedisplayshortskip}} + \@setfontsize{\small}{8pt}{9pt}% + \setlength{\abovedisplayskip}{4pt plus 1pt minus 1pt}% + \setlength{\belowdisplayskip}{\abovedisplayskip}% + \setlength{\abovedisplayshortskip}{2pt plus 1pt}% + \setlength{\belowdisplayshortskip}{\abovedisplayshortskip}} \renewcommand{\footnotesize}{% - \@setfontsize{\footnotesize}{8pt}{9pt}% - \setlength{\abovedisplayskip}{4pt plus 1pt minus .5pt}% - \setlength{\belowdisplayskip}{\abovedisplayskip}% - \setlength{\abovedisplayshortskip}{2pt plus 1pt}% - \setlength{\belowdisplayshortskip}{\abovedisplayshortskip}} + \@setfontsize{\footnotesize}{8pt}{9pt}% + \setlength{\abovedisplayskip}{4pt plus 1pt minus .5pt}% + \setlength{\belowdisplayskip}{\abovedisplayskip}% + \setlength{\abovedisplayshortskip}{2pt plus 1pt}% + \setlength{\belowdisplayshortskip}{\abovedisplayshortskip}} \renewcommand{\large}{\@setfontsize{\large}{11pt}{13pt}} @@ -471,52 +471,53 @@ \relax \fi\fi - + % Abstract % -------- \renewenvironment{abstract}{% - \section*{Abstract}% - \normalsize}{% - } - + \section*{Abstract}% + \normalsize}{% + } + % Bibliography % ------------ \renewenvironment{thebibliography}[1] - {\section*{\refname - \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}}% - \list{\@biblabel{\@arabic\c@enumiv}}% - {\settowidth\labelwidth{\@biblabel{#1}}% - \leftmargin\labelwidth - \advance\leftmargin\labelsep - \@openbib@code - \usecounter{enumiv}% - \let\p@enumiv\@empty - \renewcommand\theenumiv{\@arabic\c@enumiv}}% - \bibfont - \softraggedright%%%\sloppy - \clubpenalty4000 - \@clubpenalty \clubpenalty - \widowpenalty4000% - \sfcode`\.\@m} - {\def\@noitemerr - {\@latex@warning{Empty `thebibliography' environment}}% - \endlist} + {\section*{\refname + \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}}% + \list{\@biblabel{\@arabic\c@enumiv}}% + {\settowidth\labelwidth{\@biblabel{#1}}% + \leftmargin\labelwidth + \advance\leftmargin\labelsep + \@openbib@code + \usecounter{enumiv}% + \let\p@enumiv\@empty + \renewcommand\theenumiv{\@arabic\c@enumiv}}% + \bibfont + \softraggedright%%%\sloppy + \clubpenalty4000 + \@clubpenalty \clubpenalty + \widowpenalty4000% + \sfcode`\.\@m} + {\def\@noitemerr + {\@latex@warning{Empty `thebibliography' environment}}% + \endlist} \if \@natbib \usepackage{natbib} \setlength{\bibsep}{3pt plus .5pt minus .25pt} -\bibpunct{[}{]}{,}{A}{}{,} +\bibpunct{(}{)}{;}{A}{}{,} +\let \ncite = \cite \let \cite = \citep \fi \def \bibfont {\small} - + % Categories % ---------- @@ -524,25 +525,25 @@ \@setflag \@firstcategory = \@true \newcommand{\category}[3]{% - \if \@firstcategory - \paragraph*{Categories and Subject Descriptors}% - \@setflag \@firstcategory = \@false - \else - \unskip ;\hspace{.75em}% - \fi - \@ifnextchar [{\@category{#1}{#2}{#3}}{\@category{#1}{#2}{#3}[]}} + \if \@firstcategory + \paragraph*{Categories and Subject Descriptors}% + \@setflag \@firstcategory = \@false + \else + \unskip ;\hspace{.75em}% + \fi + \@ifnextchar [{\@category{#1}{#2}{#3}}{\@category{#1}{#2}{#3}[]}} \def \@category #1#2#3[#4]{% - {\let \and = \relax - #1 [\textit{#2}]% - \if \@emptyargp{#4}% - \if \@notp{\@emptyargp{#3}}: #3\fi - \else - :\space - \if \@notp{\@emptyargp{#3}}#3---\fi - \textrm{#4}% - \fi}} - + {\let \and = \relax + #1 [\textit{#2}]% + \if \@emptyargp{#4}% + \if \@notp{\@emptyargp{#3}}: #3\fi + \else + :\space + \if \@notp{\@emptyargp{#3}}#3---\fi + \textrm{#4}% + \fi}} + % Copyright Notice % --------- ------ @@ -550,125 +551,120 @@ \def \ftype@copyrightbox {8} \def \@toappear {} \def \@permission {} -\def \@reprintprice {} \def \@copyrightspace {% - \@float{copyrightbox}[b]% - \vbox to 1in{% - \vfill - \parbox[b]{20pc}{% - \scriptsize - \if \@preprint - [Copyright notice will appear here - once 'preprint' option is removed.]\par - \else - \@toappear - \fi - \if \@reprint - \noindent Reprinted from \@conferencename, - \@proceedings, - \@conferenceinfo, - pp.~\number\thepage--\pageref{sigplanconf@finalpage}.\par - \fi}}% - \end@float} + \@float{copyrightbox}[b]% + \vbox to 1in{% + \vfill + \parbox[b]{20pc}{% + \scriptsize + \if \@preprint + [Copyright notice will appear here + once 'preprint' option is removed.]\par + \else + \@toappear + \fi + \if \@reprint + \noindent Reprinted from \@conferencename, + \@proceedings, + \@conferenceinfo, + pp.~\number\thepage--\pageref{sigplanconf@finalpage}.\par + \fi}}% + \end@float} \long\def \toappear #1{% - \def \@toappear {#1}} + \def \@toappear {#1}} \toappear{% - \noindent \@permission \par - \vspace{2pt} - \noindent \textsl{\@conferencename}\quad \@conferenceinfo \par - \noindent Copyright \copyright\ \@copyrightyear\ ACM \@copyrightdata - \dots \@reprintprice\par} - -\newcommand{\reprintprice}[1]{% - \gdef \@reprintprice {#1}} -\reprintprice{\$10.00} + \noindent \@permission \par + \vspace{2pt} + \noindent \textsl{\@conferencename}\quad \@conferenceinfo \par + \noindent Copyright \copyright\ \@copyrightyear\ ACM \@copyrightdata + \dots \$5.00\par} \newcommand{\permission}[1]{% - \gdef \@permission {#1}} + \gdef \@permission {#1}} \permission{% - Permission to make digital or hard copies of all or - part of this work for personal or classroom use is granted without - fee provided that copies are not made or distributed for profit or - commercial advantage and that copies bear this notice and the full - citation on the first page. To copy otherwise, to republish, to - post on servers or to redistribute to lists, requires prior specific - permission and/or a fee.} + Permission to make digital or hard copies of all or + part of this work for personal or classroom use is granted without + fee provided that copies are not made or distributed for profit or + commercial advantage and that copies bear this notice and the full + citation on the first page. To copy otherwise, to republish, to + post on servers or to redistribute to lists, requires prior specific + permission and/or a fee.} % Here we have some alternate permission statements and copyright lines: \newcommand{\ACMCanadapermission}{% - \permission{% - Copyright \@copyrightyear\ Association for Computing Machinery. - ACM acknowledges that - this contribution was authored or co-authored by an affiliate of the - National Research Council of Canada (NRC). - As such, the Crown in Right of - Canada retains an equal interest in the copyright, however granting - nonexclusive, royalty-free right to publish or reproduce this article, - or to allow others to do so, provided that clear attribution - is also given to the authors and the NRC.}} + \permission{% + Copyright \@copyrightyear\ Association for Computing Machinery. + ACM acknowledges that + this contribution was authored or co-authored by an affiliate of the + National Research Council of Canada (NRC). + As such, the Crown in Right of + Canada retains an equal interest in the copyright, however granting + nonexclusive, royalty-free right to publish or reproduce this article, + or to allow others to do so, provided that clear attribution + is also given to the authors and the NRC.}} \newcommand{\ACMUSpermission}{% - \permission{% - Copyright \@copyrightyear\ Association for - Computing Machinery. ACM acknowledges that - this contribution was authored or co-authored - by a contractor or affiliate - of the U.S. Government. As such, the Government retains a nonexclusive, - royalty-free right to publish or reproduce this article, - or to allow others to do so, for Government purposes only.}} + \permission{% + Copyright \@copyrightyear\ Association for + Computing Machinery. ACM acknowledges that + this contribution was authored or co-authored + by a contractor or affiliate + of the U.S. Government. As such, the Government retains a nonexclusive, + royalty-free right to publish or reproduce this article, + or to allow others to do so, for Government purposes only.}} \newcommand{\authorpermission}{% - \permission{% - Copyright is held by the author/owner(s).} - \toappear{% - \noindent \@permission \par - \vspace{2pt} - \noindent \textsl{\@conferencename}\quad \@conferenceinfo \par - ACM \@copyrightdata.}} + \permission{% + Copyright is held by the author/owner(s).} + \toappear{% + \noindent \@permission \par + \vspace{2pt} + \noindent \textsl{\@conferencename}\quad \@conferenceinfo \par + ACM \@copyrightdata.}} \newcommand{\Sunpermission}{% - \permission{% - Copyright is held by Sun Microsystems, Inc.}% - \toappear{% - \noindent \@permission \par - \vspace{2pt} - \noindent \textsl{\@conferencename}\quad \@conferenceinfo \par - ACM \@copyrightdata.}} + \permission{% + Copyright is held by Sun Microsystems, Inc.}% + \toappear{% + \noindent \@permission \par + \vspace{2pt} + \noindent \textsl{\@conferencename}\quad \@conferenceinfo \par + ACM \@copyrightdata.}} \newcommand{\USpublicpermission}{% - \permission{% - This paper is authored by an employee(s) of the United States - Government and is in the public domain.}% - \toappear{% - \noindent \@permission \par - \vspace{2pt} - \noindent \textsl{\@conferencename}\quad \@conferenceinfo \par - ACM \@copyrightdata.}} - + \permission{% + This paper is authored by an employee(s) of the United States + Government and is in the public domain.}% + \toappear{% + \noindent \@permission \par + \vspace{2pt} + \noindent \textsl{\@conferencename}\quad \@conferenceinfo \par + ACM \@copyrightdata.}} + % Enunciations % ------------ \def \@begintheorem #1#2{% {name}{number} - \trivlist - \item[\hskip \labelsep \textsc{#1 #2.}]% - \itshape\selectfont - \ignorespaces} + \trivlist + \item[\hskip \labelsep \textsc{#1 #2.}]% + \itshape\selectfont + \ignorespaces} \def \@opargbegintheorem #1#2#3{% {name}{number}{title} - \trivlist - \item[% - \hskip\labelsep \textsc{#1\ #2}% - \if \@notp{\@emptyargp{#3}}\nut (#3).\fi]% - \itshape\selectfont - \ignorespaces} - + \trivlist + \item[% + \hskip\labelsep \textsc{#1\ #2}% + \if \@notp{\@emptyargp{#3}}\nut (#3).\fi]% + \itshape\selectfont + \ignorespaces} + % Figures % ------- @@ -676,24 +672,24 @@ \@setflag \@caprule = \@true \long\def \@makecaption #1#2{% - \addvspace{4pt} - \if \@caprule - \hrule width \hsize height .33pt - \vspace{4pt} - \fi - \setbox \@tempboxa = \hbox{\@setfigurenumber{#1.}\nut #2}% - \if \@dimgtrp{\wd\@tempboxa}{\hsize}% - \noindent \@setfigurenumber{#1.}\nut #2\par - \else - \centerline{\box\@tempboxa}% - \fi} + \addvspace{4pt} + \if \@caprule + \hrule width \hsize height .33pt + \vspace{4pt} + \fi + \setbox \@tempboxa = \hbox{\@setfigurenumber{#1.}\nut #2}% + \if \@dimgtrp{\wd\@tempboxa}{\hsize}% + \noindent \@setfigurenumber{#1.}\nut #2\par + \else + \centerline{\box\@tempboxa}% + \fi} \newcommand{\nocaptionrule}{% - \@setflag \@caprule = \@false} + \@setflag \@caprule = \@false} \def \@setfigurenumber #1{% - {\rmfamily \bfseries \selectfont #1}} - + {\rmfamily \bfseries \selectfont #1}} + % Hierarchy % --------- @@ -705,68 +701,68 @@ \newskip{\@sectionbelowskip} \if \@blockstyle - \setlength{\@sectionbelowskip}{0.1pt}% + \setlength{\@sectionbelowskip}{0.1pt}% \else - \setlength{\@sectionbelowskip}{4pt}% + \setlength{\@sectionbelowskip}{4pt}% \fi \renewcommand{\section}{% - \@startsection - {section}% - {1}% - {0pt}% - {-\@sectionaboveskip}% - {\@sectionbelowskip}% - {\large \bfseries \raggedright}} + \@startsection + {section}% + {1}% + {0pt}% + {-\@sectionaboveskip}% + {\@sectionbelowskip}% + {\large \bfseries \raggedright}} \newskip{\@subsectionaboveskip} \setvspace{\@subsectionaboveskip}{8pt plus 2pt minus 2pt} \newskip{\@subsectionbelowskip} \if \@blockstyle - \setlength{\@subsectionbelowskip}{0.1pt}% + \setlength{\@subsectionbelowskip}{0.1pt}% \else - \setlength{\@subsectionbelowskip}{4pt}% + \setlength{\@subsectionbelowskip}{4pt}% \fi \renewcommand{\subsection}{% - \@startsection% - {subsection}% - {2}% - {0pt}% - {-\@subsectionaboveskip}% - {\@subsectionbelowskip}% - {\normalsize \bfseries \raggedright}} + \@startsection% + {subsection}% + {2}% + {0pt}% + {-\@subsectionaboveskip}% + {\@subsectionbelowskip}% + {\normalsize \bfseries \raggedright}} \renewcommand{\subsubsection}{% - \@startsection% - {subsubsection}% - {3}% - {0pt}% - {-\@subsectionaboveskip} - {\@subsectionbelowskip}% - {\normalsize \bfseries \raggedright}} + \@startsection% + {subsubsection}% + {3}% + {0pt}% + {-\@subsectionaboveskip} + {\@subsectionbelowskip}% + {\normalsize \bfseries \raggedright}} \newskip{\@paragraphaboveskip} \setvspace{\@paragraphaboveskip}{6pt plus 2pt minus 2pt} \renewcommand{\paragraph}{% - \@startsection% - {paragraph}% - {4}% - {0pt}% - {\@paragraphaboveskip} - {-1em}% - {\normalsize \bfseries \if \@times \itshape \fi}} + \@startsection% + {paragraph}% + {4}% + {0pt}% + {\@paragraphaboveskip} + {-1em}% + {\normalsize \bfseries \if \@times \itshape \fi}} \renewcommand{\subparagraph}{% - \@startsection% - {subparagraph}% - {4}% - {0pt}% - {\@paragraphaboveskip} - {-1em}% - {\normalsize \itshape}} + \@startsection% + {subparagraph}% + {4}% + {0pt}% + {\@paragraphaboveskip} + {-1em}% + {\normalsize \itshape}} % Standard headings: @@ -775,7 +771,7 @@ \newcommand{\keywords}{\paragraph*{Keywords}} \newcommand{\terms}{\paragraph*{General Terms}} - + % Identification % -------------- @@ -788,22 +784,22 @@ \newcommand{\conferenceinfo}[2]{% - \gdef \@conferencename {#1}% - \gdef \@conferenceinfo {#2}} + \gdef \@conferencename {#1}% + \gdef \@conferenceinfo {#2}} \newcommand{\copyrightyear}[1]{% - \gdef \@copyrightyear {#1}} + \gdef \@copyrightyear {#1}} \let \CopyrightYear = \copyrightyear \newcommand{\copyrightdata}[1]{% - \gdef \@copyrightdata {#1}} + \gdef \@copyrightdata {#1}} \let \crdata = \copyrightdata \newcommand{\proceedings}[1]{% - \gdef \@proceedings {#1}} - + \gdef \@proceedings {#1}} + % Lists % ----- @@ -816,11 +812,11 @@ \setlength{\topsep}{\standardvspace} \if \@blockstyle - \setlength{\itemsep}{1pt} - \setlength{\parsep}{3pt} + \setlength{\itemsep}{1pt} + \setlength{\parsep}{3pt} \else - \setlength{\itemsep}{1pt} - \setlength{\parsep}{3pt} + \setlength{\itemsep}{1pt} + \setlength{\parsep}{3pt} \fi \renewcommand{\labelitemi}{{\small \centeroncapheight{\textbullet}}} @@ -829,8 +825,8 @@ \renewcommand{\labelitemiv}{{\Large \textperiodcentered}} \renewcommand{\@listi}{% - \leftmargin = \leftmargini - \listparindent = 0pt} + \leftmargin = \leftmargini + \listparindent = 0pt} %%% \itemsep = 1pt %%% \parsep = 3pt} %%% \listparindent = \parindent} @@ -838,54 +834,54 @@ \let \@listI = \@listi \renewcommand{\@listii}{% - \leftmargin = \leftmarginii - \topsep = 1pt - \labelwidth = \leftmarginii - \advance \labelwidth by -\labelsep - \listparindent = \parindent} + \leftmargin = \leftmarginii + \topsep = 1pt + \labelwidth = \leftmarginii + \advance \labelwidth by -\labelsep + \listparindent = \parindent} \renewcommand{\@listiii}{% - \leftmargin = \leftmarginiii - \labelwidth = \leftmarginiii - \advance \labelwidth by -\labelsep - \listparindent = \parindent} + \leftmargin = \leftmarginiii + \labelwidth = \leftmarginiii + \advance \labelwidth by -\labelsep + \listparindent = \parindent} \renewcommand{\@listiv}{% - \leftmargin = \leftmarginiv - \labelwidth = \leftmarginiv - \advance \labelwidth by -\labelsep - \listparindent = \parindent} - + \leftmargin = \leftmarginiv + \labelwidth = \leftmarginiv + \advance \labelwidth by -\labelsep + \listparindent = \parindent} + % Mathematics % ----------- \def \theequation {\arabic{equation}} - + % Miscellaneous % ------------- \newcommand{\balancecolumns}{% - \vfill\eject - \global\@colht = \textheight - \global\ht\@cclv = \textheight} + \vfill\eject + \global\@colht = \textheight + \global\ht\@cclv = \textheight} \newcommand{\nut}{\hspace{.5em}} \newcommand{\softraggedright}{% - \let \\ = \@centercr - \leftskip = 0pt - \rightskip = 0pt plus 10pt} - + \let \\ = \@centercr + \leftskip = 0pt + \rightskip = 0pt plus 10pt} + % Program Code % ------- ---- \newcommand{\mono}[1]{% - {\@tempdima = \fontdimen2\font - \texttt{\spaceskip = 1.1\@tempdima #1}}} - + {\@tempdima = \fontdimen2\font + \texttt{\spaceskip = 1.1\@tempdima #1}}} + % Running Heads and Feet % ------- ----- --- ---- @@ -893,26 +889,26 @@ \def \@preprintfooter {} \newcommand{\preprintfooter}[1]{% - \gdef \@preprintfooter {#1}} + \gdef \@preprintfooter {#1}} \if \@preprint \def \ps@plain {% - \let \@mkboth = \@gobbletwo - \let \@evenhead = \@empty - \def \@evenfoot {\scriptsize \textit{\@preprintfooter}\hfil \thepage \hfil - \textit{\@formatyear}}% - \let \@oddhead = \@empty - \let \@oddfoot = \@evenfoot} + \let \@mkboth = \@gobbletwo + \let \@evenhead = \@empty + \def \@evenfoot {\scriptsize \textit{\@preprintfooter}\hfil \thepage \hfil + \textit{\@formatyear}}% + \let \@oddhead = \@empty + \let \@oddfoot = \@evenfoot} \else\if \@reprint \def \ps@plain {% - \let \@mkboth = \@gobbletwo - \let \@evenhead = \@empty - \def \@evenfoot {\scriptsize \hfil \thepage \hfil}% - \let \@oddhead = \@empty - \let \@oddfoot = \@evenfoot} + \let \@mkboth = \@gobbletwo + \let \@evenhead = \@empty + \def \@evenfoot {\scriptsize \hfil \thepage \hfil}% + \let \@oddhead = \@empty + \let \@oddfoot = \@evenfoot} \else @@ -923,15 +919,15 @@ \fi\fi \def \@formatyear {% - \number\year/\number\month/\number\day} - + \number\year/\number\month/\number\day} + % Special Characters % ------- ---------- \DeclareRobustCommand{\euro}{% - \protect{\rlap{=}}{\sf \kern .1em C}} - + \protect{\rlap{=}}{\sf \kern .1em C}} + % Title Page % ----- ---- @@ -949,207 +945,202 @@ \def \@titlebanner {} \renewcommand{\title}[1]{% - \gdef \@titletext {#1}} + \gdef \@titletext {#1}} \newcommand{\subtitle}[1]{% - \gdef \@subtitletext {#1}} + \gdef \@subtitletext {#1}} \newcommand{\authorinfo}[3]{% {names}{affiliation}{email/URL} - \global\@increment \@authorcount - \@withname\gdef {\@authorname\romannumeral\@authorcount}{#1}% - \@withname\gdef {\@authoraffil\romannumeral\@authorcount}{#2}% - \@withname\gdef {\@authoremail\romannumeral\@authorcount}{#3}} + \global\@increment \@authorcount + \@withname\gdef {\@authorname\romannumeral\@authorcount}{#1}% + \@withname\gdef {\@authoraffil\romannumeral\@authorcount}{#2}% + \@withname\gdef {\@authoremail\romannumeral\@authorcount}{#3}} \renewcommand{\author}[1]{% - \@latex@error{The \string\author\space command is obsolete; - use \string\authorinfo}{}} + \@latex@error{The \string\author\space command is obsolete; + use \string\authorinfo}{}} \newcommand{\titlebanner}[1]{% - \gdef \@titlebanner {#1}} + \gdef \@titlebanner {#1}} \renewcommand{\maketitle}{% - \pagestyle{plain}% - \if \@onecolumn - {\hsize = \standardtextwidth - \@maketitle}% - \else - \twocolumn[\@maketitle]% - \fi - \@placetitlenotes - \if \@copyrightwanted \@copyrightspace \fi} + \pagestyle{plain}% + \if \@onecolumn + {\hsize = \standardtextwidth + \@maketitle}% + \else + \twocolumn[\@maketitle]% + \fi + \@placetitlenotes + \if \@copyrightwanted \@copyrightspace \fi} \def \@maketitle {% - \begin{center} - \@settitlebanner - \let \thanks = \titlenote - {\leftskip = 0pt plus 0.25\linewidth - \rightskip = 0pt plus 0.25 \linewidth - \parfillskip = 0pt - \spaceskip = .7em - \noindent \LARGE \bfseries \@titletext \par} - \vskip 6pt - \noindent \Large \@subtitletext \par - \vskip 12pt - \ifcase \@authorcount - \@latex@error{No authors were specified for this paper}{}\or - \@titleauthors{i}{}{}\or - \@titleauthors{i}{ii}{}\or - \@titleauthors{i}{ii}{iii}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{}{}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% - \@titleauthors{vii}{}{}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% - \@titleauthors{vii}{viii}{}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% - \@titleauthors{vii}{viii}{ix}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% - \@titleauthors{vii}{viii}{ix}\@titleauthors{x}{}{}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% - \@titleauthors{vii}{viii}{ix}\@titleauthors{x}{xi}{}\or - \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% - \@titleauthors{vii}{viii}{ix}\@titleauthors{x}{xi}{xii}% - \else - \@latex@error{Cannot handle more than 12 authors}{}% - \fi - \vspace{1.75pc} - \end{center}} + \begin{center} + \@settitlebanner + \let \thanks = \titlenote + \noindent \LARGE \bfseries \@titletext \par + \vskip 6pt + \noindent \Large \@subtitletext \par + \vskip 12pt + \ifcase \@authorcount + \@latex@error{No authors were specified for this paper}{}\or + \@titleauthors{i}{}{}\or + \@titleauthors{i}{ii}{}\or + \@titleauthors{i}{ii}{iii}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{}{}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% + \@titleauthors{vii}{}{}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% + \@titleauthors{vii}{viii}{}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% + \@titleauthors{vii}{viii}{ix}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% + \@titleauthors{vii}{viii}{ix}\@titleauthors{x}{}{}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% + \@titleauthors{vii}{viii}{ix}\@titleauthors{x}{xi}{}\or + \@titleauthors{i}{ii}{iii}\@titleauthors{iv}{v}{vi}% + \@titleauthors{vii}{viii}{ix}\@titleauthors{x}{xi}{xii}% + \else + \@latex@error{Cannot handle more than 12 authors}{}% + \fi + \vspace{1.75pc} + \end{center}} \def \@settitlebanner {% - \if \@andp{\@preprint}{\@notp{\@emptydefp{\@titlebanner}}}% - \vbox to 0pt{% - \vskip -32pt - \noindent \textbf{\@titlebanner}\par - \vss}% - \nointerlineskip - \fi} + \if \@andp{\@preprint}{\@notp{\@emptydefp{\@titlebanner}}}% + \vbox to 0pt{% + \vskip -32pt + \noindent \textbf{\@titlebanner}\par + \vss}% + \nointerlineskip + \fi} \def \@titleauthors #1#2#3{% - \if \@andp{\@emptyargp{#2}}{\@emptyargp{#3}}% - \noindent \@setauthor{40pc}{#1}{\@false}\par - \else\if \@emptyargp{#3}% - \noindent \@setauthor{17pc}{#1}{\@false}\hspace{3pc}% - \@setauthor{17pc}{#2}{\@false}\par - \else - \noindent \@setauthor{12.5pc}{#1}{\@false}\hspace{2pc}% - \@setauthor{12.5pc}{#2}{\@false}\hspace{2pc}% - \@setauthor{12.5pc}{#3}{\@true}\par - \relax - \fi\fi - \vspace{20pt}} + \if \@andp{\@emptyargp{#2}}{\@emptyargp{#3}}% + \noindent \@setauthor{40pc}{#1}{\@false}\par + \else\if \@emptyargp{#3}% + \noindent \@setauthor{17pc}{#1}{\@false}\hspace{3pc}% + \@setauthor{17pc}{#2}{\@false}\par + \else + \noindent \@setauthor{12.5pc}{#1}{\@false}\hspace{2pc}% + \@setauthor{12.5pc}{#2}{\@false}\hspace{2pc}% + \@setauthor{12.5pc}{#3}{\@true}\par + \relax + \fi\fi + \vspace{20pt}} \def \@setauthor #1#2#3{% {width}{text}{unused} - \vtop{% - \def \and {% - \hspace{16pt}} - \hsize = #1 - \normalfont - \centering - \large \@name{\@authorname#2}\par - \vspace{5pt} - \normalsize \@name{\@authoraffil#2}\par - \vspace{2pt} - \textsf{\@name{\@authoremail#2}}\par}} + \vtop{% + \def \and {% + \hspace{16pt}} + \hsize = #1 + \normalfont + \centering + \large \@name{\@authorname#2}\par + \vspace{5pt} + \normalsize \@name{\@authoraffil#2}\par + \vspace{2pt} + \textsf{\@name{\@authoremail#2}}\par}} \def \@maybetitlenote #1{% - \if \@andp{#1}{\@gtrp{\@authorcount}{3}}% - \titlenote{See page~\pageref{@addauthors} for additional authors.}% - \fi} + \if \@andp{#1}{\@gtrp{\@authorcount}{3}}% + \titlenote{See page~\pageref{@addauthors} for additional authors.}% + \fi} \newtoks{\@fnmark} \newcommand{\titlenote}[1]{% - \global\@increment \@titlenotecount - \ifcase \@titlenotecount \relax \or - \@fnmark = {\ast}\or - \@fnmark = {\dagger}\or - \@fnmark = {\ddagger}\or - \@fnmark = {\S}\or - \@fnmark = {\P}\or - \@fnmark = {\ast\ast}% - \fi - \,$^{\the\@fnmark}$% - \edef \reserved@a {\noexpand\@appendtotext{% - \noexpand\@titlefootnote{\the\@fnmark}}}% - \reserved@a{#1}} + \global\@increment \@titlenotecount + \ifcase \@titlenotecount \relax \or + \@fnmark = {\ast}\or + \@fnmark = {\dagger}\or + \@fnmark = {\ddagger}\or + \@fnmark = {\S}\or + \@fnmark = {\P}\or + \@fnmark = {\ast\ast}% + \fi +% \,$^{\the\@fnmark}$% + \edef \reserved@a {\noexpand\@appendtotext{% + \noexpand\@titlefootnote{\the\@fnmark}}}% + \reserved@a{#1}} \def \@appendtotext #1#2{% - \global\@titlenotetext = \expandafter{\the\@titlenotetext #1{#2}}} + \global\@titlenotetext = \expandafter{\the\@titlenotetext #1{#2}}} \newcount{\@authori} \iffalse \def \additionalauthors {% - \if \@gtrp{\@authorcount}{3}% - \section{Additional Authors}% - \label{@addauthors}% - \noindent - \@authori = 4 - {\let \\ = ,% - \loop - \textbf{\@name{\@authorname\romannumeral\@authori}}, - \@name{\@authoraffil\romannumeral\@authori}, - email: \@name{\@authoremail\romannumeral\@authori}.% - \@increment \@authori - \if \@notp{\@gtrp{\@authori}{\@authorcount}} \repeat}% - \par - \fi - \global\@setflag \@addauthorsdone = \@true} + \if \@gtrp{\@authorcount}{3}% + \section{Additional Authors}% + \label{@addauthors}% + \noindent + \@authori = 4 + {\let \\ = ,% + \loop + \textbf{\@name{\@authorname\romannumeral\@authori}}, + \@name{\@authoraffil\romannumeral\@authori}, + email: \@name{\@authoremail\romannumeral\@authori}.% + \@increment \@authori + \if \@notp{\@gtrp{\@authori}{\@authorcount}} \repeat}% + \par + \fi + \global\@setflag \@addauthorsdone = \@true} \fi \let \addauthorsection = \additionalauthors \def \@placetitlenotes { - \the\@titlenotetext} - + \the\@titlenotetext} + % Utilities % --------- \newcommand{\centeroncapheight}[1]{% - {\setbox\@tempboxa = \hbox{#1}% - \@measurecapheight{\@tempdima}% % Calculate ht(CAP) - ht(text) - \advance \@tempdima by -\ht\@tempboxa % ------------------ - \divide \@tempdima by 2 % 2 - \raise \@tempdima \box\@tempboxa}} + {\setbox\@tempboxa = \hbox{#1}% + \@measurecapheight{\@tempdima}% % Calculate ht(CAP) - ht(text) + \advance \@tempdima by -\ht\@tempboxa % ------------------ + \divide \@tempdima by 2 % 2 + \raise \@tempdima \box\@tempboxa}} \newbox{\@measbox} \def \@measurecapheight #1{% {\dimen} - \setbox\@measbox = \hbox{ABCDEFGHIJKLMNOPQRSTUVWXYZ}% - #1 = \ht\@measbox} + \setbox\@measbox = \hbox{ABCDEFGHIJKLMNOPQRSTUVWXYZ}% + #1 = \ht\@measbox} \long\def \@titlefootnote #1#2{% - \insert\footins{% - \reset@font\footnotesize - \interlinepenalty\interfootnotelinepenalty - \splittopskip\footnotesep - \splitmaxdepth \dp\strutbox \floatingpenalty \@MM - \hsize\columnwidth \@parboxrestore + \insert\footins{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore %%% \protected@edef\@currentlabel{% %%% \csname p@footnote\endcsname\@thefnmark}% - \color@begingroup - \def \@makefnmark {$^{#1}$}% - \@makefntext{% - \rule\z@\footnotesep\ignorespaces#2\@finalstrut\strutbox}% - \color@endgroup}} - + \color@begingroup + \def \@makefnmark {$^{#1}$}% + \@makefntext{% + \rule\z@\footnotesep\ignorespaces#2\@finalstrut\strutbox}% + \color@endgroup}} + % LaTeX Modifications % ----- ------------- \def \@seccntformat #1{% - \@name{\the#1}% - \@expandaftertwice\@seccntformata \csname the#1\endcsname.\@mark - \quad} + \@name{\the#1}% + \@expandaftertwice\@seccntformata \csname the#1\endcsname.\@mark + \quad} \def \@seccntformata #1.#2\@mark{% - \if \@emptyargp{#2}.\fi} - + \if \@emptyargp{#2}.\fi} + % Revision History % -------- ------- -% SNC = Stephen Chong (chong@seas.harvard.edu) % Date Person Ver. Change % ---- ------ ---- ------ @@ -1205,18 +1196,9 @@ % 2006.08.24 PCA 1.4 Fix bug in \maketitle case command. -% 2007.03.13 PCA 1.5 The title banner only displays with the +% 2007.03.13 PCA 1.5 The title banner only display with the % 'preprint' option. % 2007.06.06 PCA 1.6 Use \bibfont in \thebibliography. % Add 'natbib' option to load and configure % the natbib package. - -% 2007.11.20 PCA 1.7 Balance line lengths in centered article -% title (thanks to Norman Ramsey). - -% 2009.01.26 PCA 1.8 Change natbib \bibpunct values. - -% 2009.04.29 SNC 1.9 Added \reprintprice to allow the -% specification of the price of a reprint, and -% set it to default to \$10.00 From 2af3c0c8b7ec1040803fe853878f5cca83ce106a Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Tue, 16 Nov 2010 12:35:37 -0500 Subject: [PATCH 42/54] Supress duplicate author lists. original commit: 01c8c281f3894f8d559541442cf5e66654f4338e --- collects/scriblib/autobib.rkt | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/collects/scriblib/autobib.rkt b/collects/scriblib/autobib.rkt index 649ec643..8971c0c2 100644 --- a/collects/scriblib/autobib.rkt +++ b/collects/scriblib/autobib.rkt @@ -1,5 +1,6 @@ #lang at-exp racket/base (require scribble/manual + racket/list scribble/core scribble/decode scribble/html-properties @@ -64,24 +65,25 @@ ")"))) (define (add-cites group bib-entries) + (define groups (for/fold ([h (hash)]) ([b (reverse bib-entries)]) + (hash-update h (author-element-names (auto-bib-author b)) + (lambda (cur) (cons b cur)) null))) (make-element #f - (list 'nbsp - "(" - (let loop ([keys bib-entries]) - (if (null? (cdr keys)) - (make-element - #f - (list - (add-cite group (car keys) 'autobib-author #f) - " " - (add-cite group (car keys) 'autobib-date #t))) - (make-element - #f - (list (loop (list (car keys))) - "; " - (loop (cdr keys)))))) - ")"))) + (append + (list 'nbsp "(") + (add-between + (for/list ([(k v) groups]) + (make-element + #f + (list* + (add-cite group (car v) 'autobib-author #f) + " " + (add-between + (for/list ([b v]) (add-cite group b 'autobib-date #t)) + ", ")))) + "; ") + (list ")")))) (define (extract-bib-key b) (author-element-names (auto-bib-author b))) From 1f37c2230a72556053b9fefd1fe1dac7692f32d9 Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Tue, 16 Nov 2010 12:36:26 -0500 Subject: [PATCH 43/54] Add @onecolumn option to scribble/sigplan original commit: 2dbbd1b58e558b029a170258f944d61a253573c3 --- collects/scribble/sigplan.rkt | 4 ++-- collects/scribble/sigplan/lang.rkt | 8 ++++++-- collects/scribblings/scribble/sigplan.scrbl | 15 +++++++++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/collects/scribble/sigplan.rkt b/collects/scribble/sigplan.rkt index e6e5bcc8..a144ac29 100644 --- a/collects/scribble/sigplan.rkt +++ b/collects/scribble/sigplan.rkt @@ -35,7 +35,7 @@ (->* () () #:rest (listof pre-content?) content?)]) -(provide preprint 10pt nocopyright +(provide preprint 10pt nocopyright onecolumn include-abstract) (define-syntax-rule (defopts name ...) @@ -45,7 +45,7 @@ stx)) ... (provide name ...))) -(defopts preprint 10pt nocopyright) +(defopts preprint 10pt nocopyright onecolumn) (define sigplan-extras (let ([abs (lambda (s) diff --git a/collects/scribble/sigplan/lang.rkt b/collects/scribble/sigplan/lang.rkt index f2aa6ef0..4c03b3eb 100644 --- a/collects/scribble/sigplan/lang.rkt +++ b/collects/scribble/sigplan/lang.rkt @@ -17,9 +17,10 @@ [(_ id . body) (let ([preprint? #f] [10pt? #f] + [onecolumn? #f] [nocopyright? #f]) (let loop ([stuff #'body]) - (syntax-case* stuff (preprint 10pt nocopyright) (lambda (a b) (eq? (syntax-e a) (syntax-e b))) + (syntax-case* stuff (onecolumn preprint 10pt nocopyright) (lambda (a b) (eq? (syntax-e a) (syntax-e b))) [(ws . body) ;; Skip intraline whitespace to find options: (and (string? (syntax-e #'ws)) @@ -28,6 +29,9 @@ [(preprint . body) (set! preprint? "preprint") (loop #'body)] + [(onecolumn . body) + (set! onecolumn? "onecolumn") + (loop #'body)] [(nocopyright . body) (set! nocopyright? "nocopyrightspace") (loop #'body)] @@ -35,7 +39,7 @@ (set! 10pt? "10pt") (loop #'body)] [body - #`(#%module-begin id (post-process #,preprint? #,10pt? #,nocopyright?) () . body)])))])) + #`(#%module-begin id (post-process #,preprint? #,10pt? #,nocopyright? #,onecolumn?) () . body)])))])) (define ((post-process . opts) doc) (let ([options diff --git a/collects/scribblings/scribble/sigplan.scrbl b/collects/scribblings/scribble/sigplan.scrbl index 2b4f14e8..8b265fd1 100644 --- a/collects/scribblings/scribble/sigplan.scrbl +++ b/collects/scribblings/scribble/sigplan.scrbl @@ -39,8 +39,19 @@ same line as @hash-lang[], with only whitespace between #lang scribble/sigplan @nocopyright }|} -The @racket[10pt], @racket[preprint], and @racket[nocopyright] options can be -used together and may appear in any order. +@defidform[onecolumn]{ + +Enables the @tt{onecolumn} option. Use @racket[onecolumn] only on the +same line as @hash-lang[], with only whitespace between +@racketmodname[scribble/sigplan] and @racket[onecolumn]: + +@codeblock{ + #lang scribble/sigplan @onecolumn +}} + +The @racket[10pt], @racket[preprint], @racket[nocopyright], and +@racket[onecolumn] options can be used together and may appear in any +order. } From 865ad8584c4290f6a55d7d35433e2480798cca73 Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Tue, 16 Nov 2010 13:27:50 -0500 Subject: [PATCH 44/54] Sort bib entries by year when authors are equal. Works only when just the year is specified. original commit: d50eac2effe61bcd7e3fa9584b5dab652b54938f --- collects/scriblib/autobib.rkt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/collects/scriblib/autobib.rkt b/collects/scriblib/autobib.rkt index 8971c0c2..0aa4d3fa 100644 --- a/collects/scriblib/autobib.rkt +++ b/collects/scriblib/autobib.rkt @@ -88,12 +88,21 @@ (define (extract-bib-key b) (author-element-names (auto-bib-author b))) +(define (extract-bib-year b) + (string->number (auto-bib-date b))) + + (define (gen-bib tag group) - (let* ([author Date: Tue, 16 Nov 2010 14:02:47 -0500 Subject: [PATCH 45/54] Fix docs. original commit: 82437faa18b79ea09da2eaaa5c7427754c61b595 --- collects/scribblings/scribble/sigplan.scrbl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collects/scribblings/scribble/sigplan.scrbl b/collects/scribblings/scribble/sigplan.scrbl index 8b265fd1..37a206bb 100644 --- a/collects/scribblings/scribble/sigplan.scrbl +++ b/collects/scribblings/scribble/sigplan.scrbl @@ -45,9 +45,9 @@ Enables the @tt{onecolumn} option. Use @racket[onecolumn] only on the same line as @hash-lang[], with only whitespace between @racketmodname[scribble/sigplan] and @racket[onecolumn]: -@codeblock{ +@codeblock|{ #lang scribble/sigplan @onecolumn -}} +}|} The @racket[10pt], @racket[preprint], @racket[nocopyright], and @racket[onecolumn] options can be used together and may appear in any From 387d5407448a048934fbf10d16e99597f02e05a9 Mon Sep 17 00:00:00 2001 From: Matthias Felleisen Date: Wed, 17 Nov 2010 16:18:20 -0500 Subject: [PATCH 46/54] wrong font size for 1column original commit: dbe896a9692a26677bb759f6fa40935cf0b5d55c --- collects/scribble/sigplan/sigplanconf.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/scribble/sigplan/sigplanconf.cls b/collects/scribble/sigplan/sigplanconf.cls index 318a5b6a..4120cbda 100644 --- a/collects/scribble/sigplan/sigplanconf.cls +++ b/collects/scribble/sigplan/sigplanconf.cls @@ -273,7 +273,7 @@ \if \@onecolumn \if \@notp{\@explicitsize}% \@setflag \@ninepoint = \@false - \PassOptionsToClass{11pt}{article}% +% \PassOptionsToClass{11pt}{article}% \fi \PassOptionsToClass{twoside,onecolumn}{article} \else From 2e87b2f3533060c9bbd6aea290734d4dafa188bd Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Mon, 15 Nov 2010 11:33:53 -0500 Subject: [PATCH 47/54] Fixed autobib doc. original commit: a888325d786e5518546246dd4b11767def614890 --- collects/scriblib/scribblings/autobib.scrbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/scriblib/scribblings/autobib.scrbl b/collects/scriblib/scribblings/autobib.scrbl index 66a7c57c..dffd1540 100644 --- a/collects/scriblib/scribblings/autobib.scrbl +++ b/collects/scriblib/scribblings/autobib.scrbl @@ -114,7 +114,7 @@ Combines elements to generate an element that is suitable for describing a technical report's location.} @defproc[(dissertation-location [#:institution institution edition any/c] - [#:number degree any/c "PhD"]) + [#:degree degree any/c "PhD"]) element?]{ Combines elements to generate an element that is suitable for From e30aedf47fcaae928fc99bc4e44a216a96a3376e Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Fri, 19 Nov 2010 17:50:52 -0600 Subject: [PATCH 48/54] adjusted scribble's sigplan setup so that the times.sty and qcourier.sty packages can be disabled. original commit: 747c735eb323dd99f98c7049b4bb358e9d8f00d1 --- collects/scribble/sigplan.rkt | 4 +-- collects/scribble/sigplan/lang.rkt | 38 +++++++++++++++++---- collects/scribblings/scribble/sigplan.scrbl | 37 ++++++++++++++++---- 3 files changed, 63 insertions(+), 16 deletions(-) diff --git a/collects/scribble/sigplan.rkt b/collects/scribble/sigplan.rkt index a144ac29..8607a800 100644 --- a/collects/scribble/sigplan.rkt +++ b/collects/scribble/sigplan.rkt @@ -35,7 +35,7 @@ (->* () () #:rest (listof pre-content?) content?)]) -(provide preprint 10pt nocopyright onecolumn +(provide preprint 10pt nocopyright onecolumn noqcourier notimes include-abstract) (define-syntax-rule (defopts name ...) @@ -45,7 +45,7 @@ stx)) ... (provide name ...))) -(defopts preprint 10pt nocopyright onecolumn) +(defopts preprint 10pt nocopyright onecolumn noqcourier notimes) (define sigplan-extras (let ([abs (lambda (s) diff --git a/collects/scribble/sigplan/lang.rkt b/collects/scribble/sigplan/lang.rkt index 4c03b3eb..bcf43a50 100644 --- a/collects/scribble/sigplan/lang.rkt +++ b/collects/scribble/sigplan/lang.rkt @@ -18,9 +18,11 @@ (let ([preprint? #f] [10pt? #f] [onecolumn? #f] - [nocopyright? #f]) + [nocopyright? #f] + [times? #t] + [qcourier? #t]) (let loop ([stuff #'body]) - (syntax-case* stuff (onecolumn preprint 10pt nocopyright) (lambda (a b) (eq? (syntax-e a) (syntax-e b))) + (syntax-case* stuff (onecolumn preprint 10pt nocopyright notimes noqcourier) (lambda (a b) (eq? (syntax-e a) (syntax-e b))) [(ws . body) ;; Skip intraline whitespace to find options: (and (string? (syntax-e #'ws)) @@ -38,19 +40,41 @@ [(10pt . body) (set! 10pt? "10pt") (loop #'body)] + [(noqcourier . body) + (set! qcourier? #f) + (loop #'body)] + [(notimes . body) + (set! times? #f) + (loop #'body)] [body - #`(#%module-begin id (post-process #,preprint? #,10pt? #,nocopyright? #,onecolumn?) () . body)])))])) + #`(#%module-begin id (post-process #,times? #,qcourier? #,preprint? #,10pt? #,nocopyright? #,onecolumn?) () . body)])))])) +#| -(define ((post-process . opts) doc) - (let ([options +The docs for the times.sty package suggests that it should not be used +so maybe we want to disable it permanently (or replace it with something else). + +Read here for more: + + http://www.ctan.org/tex-archive/macros/latex/required/psnfss/psnfss2e.pdf + +|# + +(define ((post-process times? qcourier? . opts) doc) + (let ([options (if (ormap values opts) (format "[~a]" (apply string-append (add-between (filter values opts) ", "))) "")]) (add-sigplan-styles (add-defaults doc (string->bytes/utf-8 - (format "\\documentclass~a{sigplanconf}\n\\usepackage{times}\n\\usepackage{qcourier}\n" - options)) + (format "\\documentclass~a{sigplanconf}\n~a~a" + options + (if times? + "\\usepackage{times}\n" + "") + (if qcourier? + "\\usepackage{qcourier}\n" + ""))) (scribble-file "sigplan/style.tex") (list (scribble-file "sigplan/sigplanconf.cls")) #f)))) diff --git a/collects/scribblings/scribble/sigplan.scrbl b/collects/scribblings/scribble/sigplan.scrbl index 37a206bb..bf8b2465 100644 --- a/collects/scribblings/scribble/sigplan.scrbl +++ b/collects/scribblings/scribble/sigplan.scrbl @@ -12,7 +12,7 @@ file that is included with Scribble.} @defidform[preprint]{ Enables the @tt{preprint} option. Use @racket[preprint] only on the -same line as @hash-lang[], with only whitespace between +same line as @hash-lang[], with only whitespace (or other options) between @racketmodname[scribble/sigplan] and @racket[preprint]: @verbatim[#:indent 2]|{ @@ -22,7 +22,7 @@ same line as @hash-lang[], with only whitespace between @defidform[10pt]{ Enables the @tt{10pt} option. Use @racket[10pt] only on the -same line as @hash-lang[], with only whitespace between +same line as @hash-lang[], with only whitespace (or other options) between @racketmodname[scribble/sigplan] and @racket[10pt]: @verbatim[#:indent 2]|{ @@ -32,7 +32,7 @@ same line as @hash-lang[], with only whitespace between @defidform[nocopyright]{ Enables the @tt{nocopyright} option. Use @racket[nocopyright] only on the -same line as @hash-lang[], with only whitespace between +same line as @hash-lang[], with only whitespace (or other options) between @racketmodname[scribble/sigplan] and @racket[nocopyright]: @verbatim[#:indent 2]|{ @@ -42,16 +42,39 @@ same line as @hash-lang[], with only whitespace between @defidform[onecolumn]{ Enables the @tt{onecolumn} option. Use @racket[onecolumn] only on the -same line as @hash-lang[], with only whitespace between +same line as @hash-lang[], with only whitespace (or other options) between @racketmodname[scribble/sigplan] and @racket[onecolumn]: @codeblock|{ #lang scribble/sigplan @onecolumn }|} -The @racket[10pt], @racket[preprint], @racket[nocopyright], and -@racket[onecolumn] options can be used together and may appear in any -order. + +@defidform[notimes]{ + +Disables the use of @tt{\usepackage@"{"times@"}"} in the generated LaTeX output. +Use @racket[onecolumn] only on the +same line as @hash-lang[], with only whitespace (or other options) between +@racketmodname[scribble/sigplan] and @racket[notimes]: + +@codeblock|{ + #lang scribble/sigplan @notimes +}|} + +@defidform[noqcourier]{ + +Disables the use of @tt{\usepackage@"{"qcourier@"}"} in the generated LaTeX output. +Use @racket[onecolumn] only on the +same line as @hash-lang[], with only whitespace (or other options) between +@racketmodname[scribble/sigplan] and @racket[noqcourier]: + +@codeblock|{ + #lang scribble/sigplan @noqcourier +}|} + +The @racket[10pt], @racket[preprint], @racket[nocopyright], +@racket[onecolumn], @racket[notimes], and @racket[noqcourier] +options can be used together and may appear in any order. } From 6fb5dc58de6fe9b5c2bdf21e718e9a32a7e732c6 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 26 Nov 2010 17:49:46 -0700 Subject: [PATCH 49/54] scribble: render `pict' content directly --- actually, any value that is convertible to PNG/PDF original commit: 0f86dc15afe6d0bf48a77f8aec7d66fda356082b --- collects/scribble/base-render.rkt | 43 +++++++++++++++--------- collects/scribble/core.rkt | 6 ++-- collects/scribble/html-render.rkt | 10 ++++++ collects/scribble/latex-render.rkt | 35 ++++++++++++------- collects/scribblings/scribble/core.scrbl | 5 +-- 5 files changed, 67 insertions(+), 32 deletions(-) diff --git a/collects/scribble/base-render.rkt b/collects/scribble/base-render.rkt index 2a5cace6..8dd56c06 100644 --- a/collects/scribble/base-render.rkt +++ b/collects/scribble/base-render.rkt @@ -8,6 +8,7 @@ scheme/path setup/main-collects setup/path-relativize + file/convertible "render-struct.ss") (provide render%) @@ -677,6 +678,7 @@ (render-content (traverse-element-content i ri) part ri)] [(part-relative-element? i) (render-content (part-relative-element-content i ri) part ri)] + [(convertible? i) (list "???")] [else (render-other i part ri)])) (define/public (render-other i part ri) @@ -687,13 +689,15 @@ (define copied-srcs (make-hash)) (define copied-dests (make-hash)) - (define/public (install-file fn) - (if refer-to-existing-files + (define/public (install-file fn [content #f]) + (if (and refer-to-existing-files + (not content)) (if (string? fn) (string->path fn) fn) (let ([normalized (normal-case-path (simplify-path (path->complete-path fn)))]) - (or (hash-ref copied-srcs normalized #f) + (or (and (not content) + (hash-ref copied-srcs normalized #f)) (let ([src-dir (path-only fn)] [dest-dir (get-dest-directory #t)] [fn (file-name-from-path fn)]) @@ -715,22 +719,26 @@ (let-values ([(dest-file normalized-dest-file) (let loop ([dest-file dest-file]) (let ([normalized-dest-file - (normal-case-path (simplify-path (path->complete-path dest-file)))]) - (if (file-exists? dest-file) - (cond - [(call-with-input-file* - src-file - (lambda (src) - (call-with-input-file* + (normal-case-path (simplify-path (path->complete-path dest-file)))] + [check-same + (lambda (src) + (call-with-input-file* dest-file (lambda (dest) - (or (equal? (port-file-identity src) - (port-file-identity dest)) + (or (and (not content) + (equal? (port-file-identity src) + (port-file-identity dest))) (let loop () (let ([s (read-bytes 4096 src)] [d (read-bytes 4096 dest)]) (and (equal? s d) - (or (eof-object? s) (loop)))))))))) + (or (eof-object? s) (loop)))))))))]) + (if (file-exists? dest-file) + (cond + [(or (and content + (check-same (open-input-bytes content))) + (and (not content) + (call-with-input-file* src-file check-same))) ;; same content at that destination (values dest-file normalized-dest-file)] [(hash-ref copied-dests normalized-dest-file #f) @@ -743,10 +751,15 @@ ;; new file (values dest-file normalized-dest-file))))]) (unless (file-exists? dest-file) - (copy-file src-file dest-file)) + (if content + (call-with-output-file* + dest-file + (lambda (dest) (write-bytes content dest))) + (copy-file src-file dest-file))) (hash-set! copied-dests normalized-dest-file #t) (let ([result (path->string (file-name-from-path dest-file))]) - (hash-set! copied-srcs normalized result) + (unless content + (hash-set! copied-srcs normalized result)) result)))))))) ;; ---------------------------------------- diff --git a/collects/scribble/core.rkt b/collects/scribble/core.rkt index aa68a42f..6e71a8ce 100644 --- a/collects/scribble/core.rkt +++ b/collects/scribble/core.rkt @@ -1,7 +1,8 @@ #lang scheme/base (require "private/provide-structs.ss" scheme/serialize - scheme/contract) + scheme/contract + file/convertible) ;; ---------------------------------------- @@ -119,7 +120,8 @@ (traverse-element? v) (part-relative-element? v) (multiarg-element? v) - (hash-ref content-symbols v #f))) + (hash-ref content-symbols v #f) + (convertible? v))) (provide element-style?) (define (element-style? s) diff --git a/collects/scribble/html-render.rkt b/collects/scribble/html-render.rkt index c31021c9..412b4c34 100644 --- a/collects/scribble/html-render.rkt +++ b/collects/scribble/html-render.rkt @@ -9,6 +9,7 @@ scheme/port scheme/list scheme/string + file/convertible mzlib/runtime-path setup/main-doc setup/main-collects @@ -947,6 +948,15 @@ (cond [(string? e) (super render-content e part ri)] ; short-cut for common case [(list? e) (super render-content e part ri)] ; also a short-cut + [(and (convertible? e) + (convert e 'png-bytes)) + => (lambda (bstr) + (let ([w (integer-bytes->integer (subbytes bstr 16 20) #f #t)] + [h (integer-bytes->integer (subbytes bstr 20 24) #f #t)]) + `((img ([src ,(install-file "pict.png" bstr)] + [alt "image"] + [width ,(number->string w)] + [height ,(number->string h)])))))] [(image-element? e) (let* ([src (main-collects-relative->path (image-element-path e))] [suffixes (image-element-suffixes e)] diff --git a/collects/scribble/latex-render.rkt b/collects/scribble/latex-render.rkt index a8b2ae95..459deac0 100644 --- a/collects/scribble/latex-render.rkt +++ b/collects/scribble/latex-render.rkt @@ -9,7 +9,8 @@ scheme/path scheme/string scheme/list - setup/main-collects) + setup/main-collects + file/convertible) (provide render-mixin) (define current-table-mode (make-parameter #f)) @@ -235,18 +236,26 @@ es)] [style (and (style? es) es)] [core-render (lambda (e tt?) - (if (and (image-element? e) - (not (disable-images))) - (let ([fn (install-file - (select-suffix - (main-collects-relative->path - (image-element-path e)) - (image-element-suffixes e) - '(".pdf" ".ps" ".png")))]) - (printf "\\includegraphics[scale=~a]{~a}" - (image-element-scale e) fn)) - (parameterize ([rendering-tt (or tt? (rendering-tt))]) - (super render-content e part ri))))] + (cond + [(and (image-element? e) + (not (disable-images))) + (let ([fn (install-file + (select-suffix + (main-collects-relative->path + (image-element-path e)) + (image-element-suffixes e) + '(".pdf" ".ps" ".png")))]) + (printf "\\includegraphics[scale=~a]{~a}" + (image-element-scale e) fn))] + [(and (convertible? e) + (not (disable-images)) + (convert e 'pdf-bytes)) + => (lambda (bstr) + (let ([fn (install-file "pict.pdf" bstr)]) + (printf "\\includegraphics{~a}" fn)))] + [else + (parameterize ([rendering-tt (or tt? (rendering-tt))]) + (super render-content e part ri))]))] [wrap (lambda (e s tt?) (printf "\\~a{" s) (core-render e tt?) diff --git a/collects/scribblings/scribble/core.scrbl b/collects/scribblings/scribble/core.scrbl index bf9b3aec..a64b56de 100644 --- a/collects/scribblings/scribble/core.scrbl +++ b/collects/scribblings/scribble/core.scrbl @@ -943,8 +943,9 @@ otherwise.} Returns @racket[#t] if @racket[v] is a string, symbol, @racket[element], @racket[multiarg-element], @racket[traverse-element], @racket[delayed-element], -@racket[part-relative-element], or list of @tech{content}, @racket[#f] -otherwise.} +@racket[part-relative-element], a convertible value in +the sense of @racket[convertible?], or list of @tech{content}. +Otherwise, it returns @racket[#f].} @defstruct[style ([name (or/c string? symbol? #f)] From 77e9dca243b35282e791da8dc31090ca38d3609c Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 26 Nov 2010 19:13:03 -0700 Subject: [PATCH 50/54] fixes to make pict eval results work in Scribble original commit: 5d386a99ec8121261fd61d61da9e5ac69a217488 --- collects/scribble/eval.rkt | 10 +++++++++- collects/scribble/racket.rkt | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/collects/scribble/eval.rkt b/collects/scribble/eval.rkt index 180fabb1..e204f0cb 100644 --- a/collects/scribble/eval.rkt +++ b/collects/scribble/eval.rkt @@ -8,6 +8,7 @@ racket/sandbox racket/promise racket/string + file/convertible (for-syntax racket/base)) (provide interaction @@ -38,6 +39,8 @@ (define maxlen 60) + (define-namespace-anchor anchor) + (namespace-require 'racket/base) (namespace-require '(for-syntax racket/base)) @@ -270,7 +273,12 @@ (parameterize ([sandbox-output 'string] [sandbox-error-output 'string] [sandbox-propagate-breaks #f]) - (make-evaluator '(begin)))))) + (let ([e (make-evaluator '(begin))]) + (let ([ns (namespace-anchor->namespace anchor)]) + (call-in-sandbox-context e + (lambda () + (namespace-attach-module ns 'file/convertible)))) + e))))) (define (make-base-eval-factory mod-paths) (let ([ns (delay (let ([ns (make-base-empty-namespace)]) diff --git a/collects/scribble/racket.rkt b/collects/scribble/racket.rkt index 62ef0798..06364208 100644 --- a/collects/scribble/racket.rkt +++ b/collects/scribble/racket.rkt @@ -8,6 +8,7 @@ mzlib/for syntax/modresolve syntax/modcode + file/convertible (for-syntax racket/base)) (provide define-code @@ -215,7 +216,8 @@ quote-depth)]) (if (or (element? (syntax-e c)) (delayed-element? (syntax-e c)) - (part-relative-element? (syntax-e c))) + (part-relative-element? (syntax-e c)) + (convertible? (syntax-e c))) (out (syntax-e c) #f) (out (if (and (identifier? c) color? From 90ded4003f8dd7bba1e4e264d5823891f716c1a6 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 27 Nov 2010 07:36:12 -0700 Subject: [PATCH 51/54] bitmap% convertible to 'png-bytes; more Scribble Latex; pict in Slideshow docs original commit: e97414b7bfc5182702c946dc7fcd024a19f7b191 --- collects/scribble/latex-render.rkt | 6 ++++++ collects/scribble/racket.rkt | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/collects/scribble/latex-render.rkt b/collects/scribble/latex-render.rkt index 459deac0..7fa0e56b 100644 --- a/collects/scribble/latex-render.rkt +++ b/collects/scribble/latex-render.rkt @@ -253,6 +253,12 @@ => (lambda (bstr) (let ([fn (install-file "pict.pdf" bstr)]) (printf "\\includegraphics{~a}" fn)))] + [(and (convertible? e) + (not (disable-images)) + (convert e 'png-bytes)) + => (lambda (bstr) + (let ([fn (install-file "pict.png" bstr)]) + (printf "\\includegraphics{~a}" fn)))] [else (parameterize ([rendering-tt (or tt? (rendering-tt))]) (super render-content e part ri))]))] diff --git a/collects/scribble/racket.rkt b/collects/scribble/racket.rkt index 06364208..a42247c8 100644 --- a/collects/scribble/racket.rkt +++ b/collects/scribble/racket.rkt @@ -1099,7 +1099,9 @@ (vector? v) (and (struct? v) (or (and qq - ;; Watch out for partially transparent subtypes of `element': + ;; Watch out for partially transparent subtypes of `element' + ;; or convertible values: + (not (convertible? v)) (not (element? v))) (prefab-struct-key v)))) (let ([orig-ht (unbox ht)] From 8f876ea446a630e8bc3d5c246aca10a7c8249b20 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 27 Nov 2010 15:53:49 -0700 Subject: [PATCH 52/54] move racket/draw overview to the Guide and expand it --- plus some minor collateral API improvements original commit: 8b3165d55b85cffbe3ad28be6d8bd4c218d21529 --- collects/scribble/eval.rkt | 78 +++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/collects/scribble/eval.rkt b/collects/scribble/eval.rkt index e204f0cb..4fe429c5 100644 --- a/collects/scribble/eval.rkt +++ b/collects/scribble/eval.rkt @@ -145,50 +145,56 @@ [(syntax? s) (loop (syntax-e s) ops)] [else (loop ((car ops) s) (cdr ops))]))) - (define ((do-eval ev) s) + (define (extract-to-evaluate s) (let loop ([s s][expect #f]) (syntax-case s (code:comment eval:alts eval:check) [(code:line v (code:comment . rest)) (loop (extract s cdr car) expect)] [(code:comment . rest) - (list (list (void)) "" "")] + (values #f expect)] [(eval:alts p e) (loop (extract s cdr cdr car) expect)] [(eval:check e expect) (loop (extract s cdr car) (list (syntax->datum (datum->syntax #f (extract s cdr cdr car)))))] [else - (let ([r (with-handlers ([(lambda (x) - (not (exn:break? x))) - (lambda (e) - (list (if (exn? e) - (exn-message e) - (format "uncaught exception: ~s" e)) - (get-output ev) - (get-error-output ev)))]) - (list (let ([v (do-plain-eval ev s #t)]) - (if (call-in-sandbox-context - ev - (let ([cp (current-print)]) - (lambda () - (and (eq? (current-print) cp) - (print-as-expression))))) - (make-reader-graph (copy-value v (make-hasheq))) - (box - (call-in-sandbox-context + (values s expect)]))) + + (define ((do-eval ev) s) + (let-values ([(s expect) (extract-to-evaluate s)]) + (if s + (let ([r (with-handlers ([(lambda (x) + (not (exn:break? x))) + (lambda (e) + (list (if (exn? e) + (exn-message e) + (format "uncaught exception: ~s" e)) + (get-output ev) + (get-error-output ev)))]) + (list (let ([v (do-plain-eval ev s #t)]) + (if (call-in-sandbox-context ev - (lambda () - (let ([s (open-output-string)]) - (parameterize ([current-output-port s]) - (map (current-print) v)) - (get-output-string s))))))) - (get-output ev) - (get-error-output ev)))]) - (when expect - (let ([expect (do-plain-eval ev (car expect) #t)]) - (unless (equal? (car r) expect) - (raise-syntax-error 'eval "example result check failed" s)))) - r)]))) + (let ([cp (current-print)]) + (lambda () + (and (eq? (current-print) cp) + (print-as-expression))))) + (make-reader-graph (copy-value v (make-hasheq))) + (box + (call-in-sandbox-context + ev + (lambda () + (let ([s (open-output-string)]) + (parameterize ([current-output-port s]) + (map (current-print) v)) + (get-output-string s))))))) + (get-output ev) + (get-error-output ev)))]) + (when expect + (let ([expect (do-plain-eval ev (car expect) #t)]) + (unless (equal? (car r) expect) + (raise-syntax-error 'eval "example result check failed" s)))) + r) + (values (list (list (void)) "" ""))))) (define (install ht v v2) @@ -337,9 +343,11 @@ (define-syntax-rule (quote-expr e) 'e) (define (do-interaction-eval ev e) - (parameterize ([current-command-line-arguments #()]) - (do-plain-eval (or ev (make-base-eval)) e #f)) - "") + (let-values ([(e expect) (extract-to-evaluate e)]) + (when e + (parameterize ([current-command-line-arguments #()]) + (do-plain-eval (or ev (make-base-eval)) e #f))) + "")) (define-syntax interaction-eval (syntax-rules () From d2293dc223cd2ba1d6c51718258a229294f5ad8a Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 28 Nov 2010 07:46:23 -0700 Subject: [PATCH 53/54] Scribble Latex image support (missed an earlier commit) original commit: cc82d3728525b5bac3f2cb91d249d5404a7a3bd0 --- collects/scribble/latex-render.rkt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/collects/scribble/latex-render.rkt b/collects/scribble/latex-render.rkt index 7fa0e56b..d722697d 100644 --- a/collects/scribble/latex-render.rkt +++ b/collects/scribble/latex-render.rkt @@ -249,15 +249,13 @@ (image-element-scale e) fn))] [(and (convertible? e) (not (disable-images)) - (convert e 'pdf-bytes)) - => (lambda (bstr) - (let ([fn (install-file "pict.pdf" bstr)]) - (printf "\\includegraphics{~a}" fn)))] - [(and (convertible? e) - (not (disable-images)) - (convert e 'png-bytes)) - => (lambda (bstr) - (let ([fn (install-file "pict.png" bstr)]) + (let ([ftag (lambda (v suffix) (and v (list v suffix)))]) + (or (ftag (convert e 'pdf-bytes) ".pdf") + (ftag (convert e 'eps-bytes) ".ps") + (ftag (convert e 'png-bytes) ".png")))) + => (lambda (bstr+suffix) + (let ([fn (install-file (format "pict.~a" (cadr bstr+suffix)) + (car bstr+suffix))]) (printf "\\includegraphics{~a}" fn)))] [else (parameterize ([rendering-tt (or tt? (rendering-tt))]) From 8c37f24f403c9d21c78a7e8504cac793a92c0e3d Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 28 Nov 2010 07:56:33 -0700 Subject: [PATCH 54/54] re-fix Scribble Latex image support original commit: 36669b821a350a5f8efb466bb3f6b13c0feb73c4 --- collects/scribble/latex-render.rkt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/scribble/latex-render.rkt b/collects/scribble/latex-render.rkt index d722697d..e1f006bb 100644 --- a/collects/scribble/latex-render.rkt +++ b/collects/scribble/latex-render.rkt @@ -254,7 +254,7 @@ (ftag (convert e 'eps-bytes) ".ps") (ftag (convert e 'png-bytes) ".png")))) => (lambda (bstr+suffix) - (let ([fn (install-file (format "pict.~a" (cadr bstr+suffix)) + (let ([fn (install-file (format "pict~a" (cadr bstr+suffix)) (car bstr+suffix))]) (printf "\\includegraphics{~a}" fn)))] [else