From 0ae283cd183a941509d0efcf2d71c83cccc1a98a Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 9 Jun 2007 23:21:39 +0000 Subject: [PATCH] scribblings: more explicit fonts and relative sizes for more consistent output, and colors changed to match DrScheme defaults svn: r6560 original commit: 732569c39d04d5943cfd50dc5bbfbd3f298c7145 --- collects/scribble/html-render.ss | 7 ++- collects/scribble/latex-render.ss | 23 +++++---- collects/scribble/manual.ss | 2 +- collects/scribble/scheme.ss | 12 +++-- collects/scribble/scribble.css | 56 +++++++++------------- collects/scribblings/scribble/struct.scrbl | 3 +- 6 files changed, 51 insertions(+), 52 deletions(-) diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss index 7bc8fc6c..dcbbe346 100644 --- a/collects/scribble/html-render.ss +++ b/collects/scribble/html-render.ss @@ -176,10 +176,9 @@ [(sf) `((b (font ([size "-1"][face "Helvetica"]) ,@(super render-element e part ht))))] [(subscript) `((sub ,@(super render-element e part ht)))] [(superscript) `((sup ,@(super render-element e part ht)))] - [(hspace) `((tt ,@(let ([str (content->string (element-content e))]) - (if (= 1 (string-length str)) - '(" ") - (map (lambda (c) 'nbsp) (string->list str))))))] + [(hspace) `((span ([class "hspace"]) + ,@(let ([str (content->string (element-content e))]) + (map (lambda (c) 'nbsp) (string->list str)))))] [else (error 'html-render "unrecognized style symbol: ~e" style)])] [(string? style) `((span ([class ,style]) ,@(super render-element e part ht)))] diff --git a/collects/scribble/latex-render.ss b/collects/scribble/latex-render.ss index 3355df2c..bd1d8297 100644 --- a/collects/scribble/latex-render.ss +++ b/collects/scribble/latex-render.ss @@ -35,15 +35,21 @@ (define-color "schemeplain" "black") (printf "\\newcommand{\\schemekeyword}[1]{{\\color{black}{\\texttt{\\textbf{#1}}}}}\n") (printf "\\newcommand{\\schemesyntaxlink}[1]{\\schemekeyword{#1}}\n") - (define-color "schemecomment" "Brown") - (define-color "schemeparen" "BrickRed") - (define-color "schemeinputcol" "BrickRed") - (define-color "schemesymbol" "NavyBlue") - (define-color "schemevalue" "ForestGreen") + (printf "\\definecolor{CommentColor}{rgb}{0.76,0.45,0.12}\n") + (printf "\\definecolor{ParenColor}{rgb}{0.52,0.24,0.14}\n") + (printf "\\definecolor{IdentifierColor}{rgb}{0.15,0.15,0.50}\n") + (printf "\\definecolor{ResultColor}{rgb}{0.0,0.0,0.69}\n") + (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 "schemeresult" "NavyBlue") - (define-color "schemestdout" "Purple") - (define-color "schemevariablecol" "NavyBlue") + (define-color "schemeresult" "ResultColor") + (define-color "schemestdout" "OutputColor") + (define-color "schemevariablecol" "IdentifierColor") (printf "\\newcommand{\\schemevariable}[1]{{\\schemevariablecol{\\textsl{#1}}}}\n") (define-color "schemeerrorcol" "red") (printf "\\newcommand{\\schemeerror}[1]{{\\schemeerrorcol{\\textrm{\\textit{#1}}}}}\n") @@ -134,7 +140,6 @@ [(hspace) (let ([s (content->string (element-content e))]) (case (string-length s) [(0) (void)] - [(1) (printf "{\\texttt{ }}")] ; allows a line break to replace the space [else (printf "{\\texttt{~a}}" (regexp-replace* #rx"." s "~"))]))] diff --git a/collects/scribble/manual.ss b/collects/scribble/manual.ss index aa75b113..3f15245e 100644 --- a/collects/scribble/manual.ss +++ b/collects/scribble/manual.ss @@ -64,7 +64,7 @@ [end-spaces (regexp-match-positions #rx" *$" s)]) (make-element "schemeinput" (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)))))))) (define (verbatim s) diff --git a/collects/scribble/scheme.ss b/collects/scribble/scheme.ss index 43476745..dcc06625 100644 --- a/collects/scribble/scheme.ss +++ b/collects/scribble/scheme.ss @@ -89,7 +89,7 @@ values) (if color? (make-element cls (list v)) - (make-element 'tt (list v)))) + (make-element #f (list v)))) content)) (set! dest-col (+ dest-col len)))))])) (define advance @@ -112,7 +112,10 @@ (let ([amt (- d-col dest-col)]) (when (positive? amt) (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! src-col c) (hash-table-put! next-col-map src-col dest-col)))] @@ -178,7 +181,10 @@ (out "; " comment-color) (let ([v (syntax-object->datum (cadr (syntax->list c)))]) (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)))] [(and (pair? (syntax-e c)) (eq? (syntax-e (car (syntax-e c))) 'code:contract)) diff --git a/collects/scribble/scribble.css b/collects/scribble/scribble.css index 80c49519..48ffaf7d 100644 --- a/collects/scribble/scribble.css +++ b/collects/scribble/scribble.css @@ -1,12 +1,11 @@ body { color: black; - /* background-color: #e5e5e5;*/ background-color: #ffffff; - /*background-color: beige;*/ max-width: 35em; margin-left: auto; margin-right: auto; + font-family: Times; } .refpara { @@ -130,7 +129,7 @@ list-style-type: upper-alpha; } - tt i { + i { font-family: serif; } @@ -138,12 +137,6 @@ font-family: serif; } - /* - .verbatim { - color: #4d0000; - } - */ - .ghost { color: white; } @@ -157,15 +150,19 @@ background-color: #ddddff; } + .hspace { + font-family: Courier; font-size: 80%; + } + .schemeinput { color: brown; background-color: #eeeeee; - font-family: monospace; + font-family: Courier; font-size: 80%; } .schemeparen { - color: brown; - font-family: monospace; + color: #843c24; + font-family: Courier; font-size: 80%; } .schemeopt { @@ -175,7 +172,7 @@ .schemekeyword { color: black; font-weight: bold; - font-family: monospace; + font-family: Courier; font-size: 80%; } .schemeerror { @@ -184,27 +181,25 @@ } .schemevariable { - color: navy; + color: #262680; font-style: italic; - font-family: monospace; + font-family: Courier; font-size: 80%; } .schemesymbol { - color: navy; - font-family: monospace; + color: #262680; + font-family: Courier; font-size: 80%; } .schemevaluelink { text-decoration: none; color: blue; - font-family: monospace; } .schemesyntaxlink { text-decoration: none; color: black; font-weight: bold; - font-family: monospace; } .badlink { @@ -213,23 +208,23 @@ } .schemeresult { - color: navy; - font-family: monospace; + color: #0000af; + font-family: Courier; font-size: 80%; } .schemestdout { - color: purple; - font-family: monospace; + color: #960096; + font-family: Courier; font-size: 80%; } .schemecomment { - color: teal; - font-family: monospace; + color: #c2741f; + font-family: Courier; font-size: 80%; } .schemevalue { - color: green; - font-family: monospace; + color: #228b22; + font-family: Courier; font-size: 80%; } .nonavigation { @@ -251,13 +246,6 @@ text-align: right; } - /* - .smallprint hr { - text-align: left; - width: 40%; - } - */ - .footnoterule { text-align: left; width: 40%; diff --git a/collects/scribblings/scribble/struct.scrbl b/collects/scribblings/scribble/struct.scrbl index 5f209b9a..c0ecdb97 100644 --- a/collects/scribblings/scribble/struct.scrbl +++ b/collects/scribblings/scribble/struct.scrbl @@ -52,7 +52,8 @@ A single document is reprsented as a @defterm{part}: output may be collapsed togther or replaced with a line break. In the style @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], @scheme['ndash], @scheme['ldquo],