scribblings: more explicit fonts and relative sizes for more consistent output, and colors changed to match DrScheme defaults

svn: r6560
This commit is contained in:
Matthew Flatt 2007-06-09 23:21:39 +00:00
parent 8a25ef30e6
commit 732569c39d
16 changed files with 78 additions and 73 deletions

View File

@ -176,10 +176,9 @@
[(sf) `((b (font ([size "-1"][face "Helvetica"]) ,@(super render-element e part ht))))] [(sf) `((b (font ([size "-1"][face "Helvetica"]) ,@(super render-element e part ht))))]
[(subscript) `((sub ,@(super render-element e part ht)))] [(subscript) `((sub ,@(super render-element e part ht)))]
[(superscript) `((sup ,@(super render-element e part ht)))] [(superscript) `((sup ,@(super render-element e part ht)))]
[(hspace) `((tt ,@(let ([str (content->string (element-content e))]) [(hspace) `((span ([class "hspace"])
(if (= 1 (string-length str)) ,@(let ([str (content->string (element-content e))])
'(" ") (map (lambda (c) 'nbsp) (string->list str)))))]
(map (lambda (c) 'nbsp) (string->list str))))))]
[else (error 'html-render "unrecognized style symbol: ~e" style)])] [else (error 'html-render "unrecognized style symbol: ~e" style)])]
[(string? style) [(string? style)
`((span ([class ,style]) ,@(super render-element e part ht)))] `((span ([class ,style]) ,@(super render-element e part ht)))]

View File

@ -35,15 +35,21 @@
(define-color "schemeplain" "black") (define-color "schemeplain" "black")
(printf "\\newcommand{\\schemekeyword}[1]{{\\color{black}{\\texttt{\\textbf{#1}}}}}\n") (printf "\\newcommand{\\schemekeyword}[1]{{\\color{black}{\\texttt{\\textbf{#1}}}}}\n")
(printf "\\newcommand{\\schemesyntaxlink}[1]{\\schemekeyword{#1}}\n") (printf "\\newcommand{\\schemesyntaxlink}[1]{\\schemekeyword{#1}}\n")
(define-color "schemecomment" "Brown") (printf "\\definecolor{CommentColor}{rgb}{0.76,0.45,0.12}\n")
(define-color "schemeparen" "BrickRed") (printf "\\definecolor{ParenColor}{rgb}{0.52,0.24,0.14}\n")
(define-color "schemeinputcol" "BrickRed") (printf "\\definecolor{IdentifierColor}{rgb}{0.15,0.15,0.50}\n")
(define-color "schemesymbol" "NavyBlue") (printf "\\definecolor{ResultColor}{rgb}{0.0,0.0,0.69}\n")
(define-color "schemevalue" "ForestGreen") (printf "\\definecolor{ValueColor}{rgb}{0.13,0.55,0.13}\n")
(printf "\\definecolor{OutputColor}{rgb}{0.59,0.00,0.59}\n")
(define-color "schemecomment" "CommentColor")
(define-color "schemeparen" "ParenColor")
(define-color "schemeinputcol" "ParenColor")
(define-color "schemesymbol" "IdentifierColor")
(define-color "schemevalue" "ValueColor")
(define-color "schemevaluelink" "blue") (define-color "schemevaluelink" "blue")
(define-color "schemeresult" "NavyBlue") (define-color "schemeresult" "ResultColor")
(define-color "schemestdout" "Purple") (define-color "schemestdout" "OutputColor")
(define-color "schemevariablecol" "NavyBlue") (define-color "schemevariablecol" "IdentifierColor")
(printf "\\newcommand{\\schemevariable}[1]{{\\schemevariablecol{\\textsl{#1}}}}\n") (printf "\\newcommand{\\schemevariable}[1]{{\\schemevariablecol{\\textsl{#1}}}}\n")
(define-color "schemeerrorcol" "red") (define-color "schemeerrorcol" "red")
(printf "\\newcommand{\\schemeerror}[1]{{\\schemeerrorcol{\\textrm{\\textit{#1}}}}}\n") (printf "\\newcommand{\\schemeerror}[1]{{\\schemeerrorcol{\\textrm{\\textit{#1}}}}}\n")
@ -134,7 +140,6 @@
[(hspace) (let ([s (content->string (element-content e))]) [(hspace) (let ([s (content->string (element-content e))])
(case (string-length s) (case (string-length s)
[(0) (void)] [(0) (void)]
[(1) (printf "{\\texttt{ }}")] ; allows a line break to replace the space
[else [else
(printf "{\\texttt{~a}}" (printf "{\\texttt{~a}}"
(regexp-replace* #rx"." s "~"))]))] (regexp-replace* #rx"." s "~"))]))]

View File

@ -64,7 +64,7 @@
[end-spaces (regexp-match-positions #rx" *$" s)]) [end-spaces (regexp-match-positions #rx" *$" s)])
(make-element "schemeinput" (make-element "schemeinput"
(list (hspace (cdar spaces)) (list (hspace (cdar spaces))
(make-element 'tt (list (substring s (cdar spaces) (caar end-spaces)))) (make-element #f (list (substring s (cdar spaces) (caar end-spaces))))
(hspace (- (cdar end-spaces) (caar end-spaces)))))))) (hspace (- (cdar end-spaces) (caar end-spaces))))))))
(define (verbatim s) (define (verbatim s)

View File

@ -89,7 +89,7 @@
values) values)
(if color? (if color?
(make-element cls (list v)) (make-element cls (list v))
(make-element 'tt (list v)))) (make-element #f (list v))))
content)) content))
(set! dest-col (+ dest-col len)))))])) (set! dest-col (+ dest-col len)))))]))
(define advance (define advance
@ -112,7 +112,10 @@
(let ([amt (- d-col dest-col)]) (let ([amt (- d-col dest-col)])
(when (positive? amt) (when (positive? amt)
(let ([old-dest-col dest-col]) (let ([old-dest-col dest-col])
(out (make-element 'hspace (list (make-string amt #\space))) #f) (out (if (and (= 1 amt) (not multi-line?))
(make-element 'tt (list " ")) ; allows a line break to replace the space
(make-element 'hspace (list (make-string amt #\space))))
#f)
(set! dest-col (+ old-dest-col amt)))))) (set! dest-col (+ old-dest-col amt))))))
(set! src-col c) (set! src-col c)
(hash-table-put! next-col-map src-col dest-col)))] (hash-table-put! next-col-map src-col dest-col)))]
@ -178,7 +181,10 @@
(out "; " comment-color) (out "; " comment-color)
(let ([v (syntax-object->datum (cadr (syntax->list c)))]) (let ([v (syntax-object->datum (cadr (syntax->list c)))])
(if (paragraph? v) (if (paragraph? v)
(map (lambda (v) (out v comment-color)) (paragraph-content v)) (map (lambda (v) (if (string? v)
(out v comment-color)
(out v #f)))
(paragraph-content v))
(out v comment-color)))] (out v comment-color)))]
[(and (pair? (syntax-e c)) [(and (pair? (syntax-e c))
(eq? (syntax-e (car (syntax-e c))) 'code:contract)) (eq? (syntax-e (car (syntax-e c))) 'code:contract))

View File

@ -1,12 +1,11 @@
body { body {
color: black; color: black;
/* background-color: #e5e5e5;*/
background-color: #ffffff; background-color: #ffffff;
/*background-color: beige;*/
max-width: 35em; max-width: 35em;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
font-family: Times;
} }
.refpara { .refpara {
@ -130,7 +129,7 @@
list-style-type: upper-alpha; list-style-type: upper-alpha;
} }
tt i { i {
font-family: serif; font-family: serif;
} }
@ -138,12 +137,6 @@
font-family: serif; font-family: serif;
} }
/*
.verbatim {
color: #4d0000;
}
*/
.ghost { .ghost {
color: white; color: white;
} }
@ -157,15 +150,19 @@
background-color: #ddddff; background-color: #ddddff;
} }
.hspace {
font-family: Courier; font-size: 80%;
}
.schemeinput { .schemeinput {
color: brown; color: brown;
background-color: #eeeeee; background-color: #eeeeee;
font-family: monospace; font-family: Courier; font-size: 80%;
} }
.schemeparen { .schemeparen {
color: brown; color: #843c24;
font-family: monospace; font-family: Courier; font-size: 80%;
} }
.schemeopt { .schemeopt {
@ -175,7 +172,7 @@
.schemekeyword { .schemekeyword {
color: black; color: black;
font-weight: bold; font-weight: bold;
font-family: monospace; font-family: Courier; font-size: 80%;
} }
.schemeerror { .schemeerror {
@ -184,27 +181,25 @@
} }
.schemevariable { .schemevariable {
color: navy; color: #262680;
font-style: italic; font-style: italic;
font-family: monospace; font-family: Courier; font-size: 80%;
} }
.schemesymbol { .schemesymbol {
color: navy; color: #262680;
font-family: monospace; font-family: Courier; font-size: 80%;
} }
.schemevaluelink { .schemevaluelink {
text-decoration: none; text-decoration: none;
color: blue; color: blue;
font-family: monospace;
} }
.schemesyntaxlink { .schemesyntaxlink {
text-decoration: none; text-decoration: none;
color: black; color: black;
font-weight: bold; font-weight: bold;
font-family: monospace;
} }
.badlink { .badlink {
@ -213,23 +208,23 @@
} }
.schemeresult { .schemeresult {
color: navy; color: #0000af;
font-family: monospace; font-family: Courier; font-size: 80%;
} }
.schemestdout { .schemestdout {
color: purple; color: #960096;
font-family: monospace; font-family: Courier; font-size: 80%;
} }
.schemecomment { .schemecomment {
color: teal; color: #c2741f;
font-family: monospace; font-family: Courier; font-size: 80%;
} }
.schemevalue { .schemevalue {
color: green; color: #228b22;
font-family: monospace; font-family: Courier; font-size: 80%;
} }
.nonavigation { .nonavigation {
@ -251,13 +246,6 @@
text-align: right; text-align: right;
} }
/*
.smallprint hr {
text-align: left;
width: 40%;
}
*/
.footnoterule { .footnoterule {
text-align: left; text-align: left;
width: 40%; width: 40%;

View File

@ -6,8 +6,8 @@
@title[#:tag "boxes"]{Boxes} @title[#:tag "boxes"]{Boxes}
A @defterm{box} is like a single-element vector. It prints as A @defterm{box} is like a single-element vector. It prints as
@schemefont{#&} followed by the printed form of the boxed value. A @litchar{#&} followed by the printed form of the boxed value. A
@schemefont{#&} form can also be used as an expression, but since the @litchar{#&} form can also be used as an expression, but since the
resulting box is constant, it has practically no use. resulting box is constant, it has practically no use.
@examples[ @examples[

View File

@ -20,7 +20,7 @@ instead of characters. Byte strings can be used in applications that
process pure ASCII instead of Unicode text. The printed and form of a process pure ASCII instead of Unicode text. The printed and form of a
byte string supports such uses in particular, because a byte string byte string supports such uses in particular, because a byte string
prints like the ASCII decoding of the byte string, but prefixed with a prints like the ASCII decoding of the byte string, but prefixed with a
@schemefont{#}. Unprintable ASCII characters or non-ASCII bytes in the @litchar{#}. Unprintable ASCII characters or non-ASCII bytes in the
byte string are written with octal notation. byte string are written with octal notation.
@refdetails["mz:parse-string"]{the syntax of byte strings} @refdetails["mz:parse-string"]{the syntax of byte strings}

View File

@ -9,11 +9,11 @@ A @defterm{string} is a fixed-length array of
@seclink["guide:characters"]{characters}. It prints using doublequotes, @seclink["guide:characters"]{characters}. It prints using doublequotes,
where doublequote and backslash characters within the string are where doublequote and backslash characters within the string are
escaped with backslashes. Other common string escapes are supported, escaped with backslashes. Other common string escapes are supported,
incluing @schemefont["\\n"] for a linefeed, @schemefont["\\r"] for a including @litchar["\\n"] for a linefeed, @litchar["\\r"] for a
carriage return, octal escapes using @schemefont["\\"] followed by up carriage return, octal escapes using @litchar["\\"] followed by up
to three octal digits, and hexadimal escapes with @schemefont["\\u"] to three octal digits, and hexadimal escapes with @litchar["\\u"]
(up to four digits). Unprintable characters in a string normally (up to four digits). Unprintable characters in a string normally
shown with @schemefont["\\u"] when the string is printed. shown with @litchar["\\u"] when the string is printed.
@refdetails["mz:parse-string"]{the syntax of strings} @refdetails["mz:parse-string"]{the syntax of strings}

View File

@ -19,9 +19,9 @@ character datatype is separate from numbers. The
@scheme[char->integer] and @scheme[integer->char] procedures convert @scheme[char->integer] and @scheme[integer->char] procedures convert
between scalar-value numbers and the corresponding character. between scalar-value numbers and the corresponding character.
A printable character normally prints as @schemefont["#\\"] followed A printable character normally prints as @litchar["#\\"] followed
by the represented character. An unprintable character normally prints by the represented character. An unprintable character normally prints
as @schemefont{#\u} followed by the scalar value as hexdecimal as @litchar{#\u} followed by the scalar value as hexdecimal
number. A few characters are printed specially; for example, the space number. A few characters are printed specially; for example, the space
and linefeed characters print as @scheme[#\space] and and linefeed characters print as @scheme[#\space] and
@scheme[#\newline], respectively. @scheme[#\newline], respectively.

View File

@ -21,10 +21,10 @@ the hash table is created with the @scheme['equal] flag.
] ]
A literal hash table can be written as an expression by using A literal hash table can be written as an expression by using
@schemefont{#hash} (for an @scheme[equal?]-based table) or @litchar{#hash} (for an @scheme[equal?]-based table) or
@schemefont{#hasheq} (for an @scheme[eq?]-based table). A parenthesized @litchar{#hasheq} (for an @scheme[eq?]-based table). A parenthesized
sequence must immediately follow @schemefont{#hash} or sequence must immediately follow @litchar{#hash} or
@schemefont{#hasheq}, where each element is a sequence is a dotted @litchar{#hasheq}, where each element is a sequence is a dotted
key--value pair. Literal hash tables are immutable. key--value pair. Literal hash tables are immutable.
@examples[ @examples[

View File

@ -6,7 +6,7 @@
@title[#:tag "keywords"]{Keywords} @title[#:tag "keywords"]{Keywords}
A @defterm{keyword} is similar to a symbol (see @secref["symbols"]), A @defterm{keyword} is similar to a symbol (see @secref["symbols"]),
but its printed form is prefixed with @schemefont{#:}. but its printed form is prefixed with @litchar{#:}.
@refdetails["mz:parse-keyword"]{the syntax of keywords} @refdetails["mz:parse-keyword"]{the syntax of keywords}

View File

@ -47,10 +47,10 @@ A Scheme @defterm{number} is either exact or inexact:
Inexact numbers print with a decimal point or exponent specifier, and Inexact numbers print with a decimal point or exponent specifier, and
exact numbers print as integers and fractions. The same conventions exact numbers print as integers and fractions. The same conventions
apply for reading number constants, but @schemefont{#e} or apply for reading number constants, but @litchar{#e} or
@schemefont{#i} can prefix a number to force its parsing as an exact @litchar{#i} can prefix a number to force its parsing as an exact
or inexact number. The prefixes @schemefont{#b}, @schemefont{#o}, and or inexact number. The prefixes @litchar{#b}, @litchar{#o}, and
@schemefont{#x} specificy binary, octal, and hexadecimal @litchar{#x} specificy binary, octal, and hexadecimal
interprertation of digits. interprertation of digits.
@refdetails["mz:parse-number"]{the syntax of numbers} @refdetails["mz:parse-number"]{the syntax of numbers}

View File

@ -17,7 +17,7 @@ scalar values.
Despite the occasional encoding problems, most paths can be converted Despite the occasional encoding problems, most paths can be converted
to and fom strings. Thus, procedures that accept a path argument to and fom strings. Thus, procedures that accept a path argument
always accept a string, and the printed form of a path uses the string always accept a string, and the printed form of a path uses the string
decodin of the path inside @schemefont{#<path:} and @scheme{>}. The decodin of the path inside @litchar{#<path:} and @litchar{>}. The
@scheme[display] form of a path is the same as the @scheme[display] @scheme[display] form of a path is the same as the @scheme[display]
form of its string encodings. form of its string encodings.

View File

@ -10,7 +10,7 @@ values. Unlike a list, a vector supports constant-time access and
update of its elements. update of its elements.
A vector prints similar to a list---as a parenthesized sequence of its A vector prints similar to a list---as a parenthesized sequence of its
elements---but a vector is prefixed with @schemefont{#} and the length elements---but a vector is prefixed with @litchar{#} and the length
of the vector. The vector length is optional for a vector as an of the vector. The vector length is optional for a vector as an
expression. Also, a vector as an expression implicitly quotes the expression. Also, a vector as an expression implicitly quotes the
forms for its content, which means that identifiers and parenthesized forms for its content, which means that identifiers and parenthesized
@ -28,7 +28,7 @@ forms in a vector constant represent symbols and lists.
When the last @math{n} vector elements of a vector are the same value When the last @math{n} vector elements of a vector are the same value
(as determined by @scheme[eq?]), then the last @math{n-1} instances (as determined by @scheme[eq?]), then the last @math{n-1} instances
are omitted from the printed form. The vector length shown after the are omitted from the printed form. The vector length shown after the
leading @scheme{#} effectively indicates when repeated trailing leading @litchar{#} effectively indicates when repeated trailing
elements are omitted. The same conventions apply for vectors as elements are omitted. The same conventions apply for vectors as
expressions. expressions.

View File

@ -52,7 +52,8 @@ A single document is reprsented as a @defterm{part}:
output may be collapsed togther or replaced output may be collapsed togther or replaced
with a line break. In the style with a line break. In the style
@scheme['hspace], all text is converted to @scheme['hspace], all text is converted to
uncollapsable spaces.} uncollapsable spaces that cannot be broken
across lines.}
@item{A symbol element is either @scheme['mdash], @item{A symbol element is either @scheme['mdash],
@scheme['ndash], @scheme['ldquo], @scheme['ndash], @scheme['ldquo],

View File

@ -16,6 +16,12 @@
(build-path main-doc-dir (car names)))]) (build-path main-doc-dir (car names)))])
(unless multi? (unless multi?
(make-directory* doc-dir)) (make-directory* doc-dir))
(when multi?
(for-each (lambda (name)
(let ([out-dir (build-path doc-dir name)])
(when (directory-exists? out-dir)
(delete-directory/files out-dir))))
names))
(parameterize ([current-directory dir] (parameterize ([current-directory dir]
[current-dest-directory doc-dir] [current-dest-directory doc-dir]
[current-render-mixin (if multi? [current-render-mixin (if multi?