slightly better use of CSS for tables

svn: r6591
This commit is contained in:
Matthew Flatt 2007-06-12 10:03:32 +00:00
parent f3d84a1ac4
commit 9d8a639f49
8 changed files with 44 additions and 21 deletions

View File

@ -192,12 +192,16 @@
[else (super render-element e part ht)])))
(define/override (render-table t part ht)
`((table ((cellspacing "0") ,@(case (table-style t)
[(boxed) '((width "100%") (bgcolor "#E8E8FF"))]
[(centered) '((align "center"))]
[(at-right) '((align "right"))]
[(at-left) '((align "left"))]
[else null]))
`((table ((cellspacing "0")
,@(case (table-style t)
[(boxed) '((class "boxed"))]
[(centered) '((align "center"))]
[(at-right) '((align "right"))]
[(at-left) '((align "left"))]
[else null])
,@(if (string? (table-style t))
`((class ,(table-style t)))
null))
,@(map (lambda (flows)
`(tr ,@(map (lambda (d a va)
`(td (,@(case a

View File

@ -49,6 +49,7 @@
(define-color "schemevaluelink" "blue")
(define-color "schemeresult" "ResultColor")
(define-color "schemestdout" "OutputColor")
(define-color "schememeta" "IdentifierColor")
(define-color "schemevariablecol" "IdentifierColor")
(printf "\\newcommand{\\schemevariable}[1]{{\\schemevariablecol{\\textsl{#1}}}}\n")
(define-color "schemeerrorcol" "red")

View File

@ -338,7 +338,7 @@
(list (make-flow
(list
(make-table
'((valignment top top top top top))
"prototype"
(list
(list
(to-flow
@ -383,11 +383,7 @@
(make-flow
(list
(make-table
`((valignment baseline baseline baseline baseline
baseline baseline
,@(if (has-optional? v)
'(baseline baseline baseline baseline)
null)))
"argcontract"
(list
(let ([v (if (keyword? (car v))
(cdr v)

View File

@ -405,7 +405,7 @@
(unless (null? content)
(finish-line!))
(if multi-line?
(make-table #f (map list (reverse docs)))
(make-table "schemeblock" (map list (reverse docs)))
(make-sized-element #f (reverse content) dest-col))))
(define (to-element c)

View File

@ -141,6 +141,27 @@
font-family: serif;
}
.boxed {
width: 100%;
background-color: #E8E8FF;
}
.prototype td {
vertical-align: baseline;
}
.schemeblock td {
vertical-align: baseline;
}
.argcontract td {
vertical-align: baseline;
}
.centered {
horiz-align: center;
}
.verbatim em {
font-family: serif;
}

View File

@ -41,7 +41,7 @@
(0 () 0 () () (c! checkerboard c! (c! square c! 10)))
(2 (((lib "struct.ss" "scribble") . deserialize-info:element-v0) ((lib "struct.ss" "scribble") . deserialize-info:image-file-v0)) 0 () () (0 #f (c! (0 (1 (u . "quick/images/img9.png")) (c! "[image]")))))
(0 () 0 () () circle)
(1 (((lib "struct.ss" "scribble") . deserialize-info:element-v0)) 0 () () (0 "schemevalue" (c! (u . "#<procedure:circle>"))))
(1 (((lib "struct.ss" "scribble") . deserialize-info:element-v0)) 0 () () (0 #f (c! (u . "#<procedure:circle>"))))
(0 () 0 () () (c! define c! (c! series c! mk) c! (c! hc-append c! 4 c! (c! mk c! 5) c! (c! mk c! 10) c! (c! mk c! 20))))
(0 () 0 () () (void))
(0 () 0 () () (c! series c! circle))
@ -99,8 +99,8 @@
(0 () 0 () () (c! define c! (c! add-drawing c! p) c! (c! let c! (c! (c! drawer c! (c! make-pict-drawer c! p))) c! (c! new c! canvas% c! (c! parent c! f) c! (c! style c! (c! quote c! (c! border))) c! (c! paint-callback c! (c! lambda c! (c! self c! dc) c! (c! drawer c! dc c! 0 c! 0)))))))
(0 () 0 () () (void))
(0 () 0 () () (c! add-drawing c! (c! pict+code c! (c! circle c! 10))))
(1 (((lib "struct.ss" "scribble") . deserialize-info:element-v0)) 0 () () (0 "schemevalue" (c! (u . "#2(struct:object:canvas% ...)"))))
(1 (((lib "struct.ss" "scribble") . deserialize-info:element-v0)) 0 () () (0 #f (c! (u . "#2(struct:object:canvas% ...)"))))
(0 () 0 () () (c! add-drawing c! (c! colorize c! (c! filled-flash c! 50 c! 30) c! "yellow")))
(1 (((lib "struct.ss" "scribble") . deserialize-info:element-v0)) 0 () () (0 "schemevalue" (c! (u . "#2(struct:object:canvas% ...)"))))
(1 (((lib "struct.ss" "scribble") . deserialize-info:element-v0)) 0 () () (0 #f (c! (u . "#2(struct:object:canvas% ...)"))))
(0 () 0 () () (c! scale c! (c! bitmap c! "quick/art.png") c! 0.5))
(2 (((lib "struct.ss" "scribble") . deserialize-info:element-v0) ((lib "struct.ss" "scribble") . deserialize-info:image-file-v0)) 0 () () (0 #f (c! (0 (1 (u . "quick/images/img29.png")) (c! "[image]")))))

View File

@ -2,7 +2,6 @@
(module mreval mzscheme
(require (lib "eval.ss" "scribble")
(lib "struct.ss" "scribble")
(lib "config.ss" "scribble")
(lib "scheme.ss" "scribble")
(lib "class.ss")
(lib "file.ss")
@ -135,11 +134,11 @@
[dc (make-object (mred:bitmap-dc%) bm)])
(send dc set-smoothing 'aligned)
(send dc clear)
(((ss:make-pict-drawer) ((ss:colorize) v value-color)) dc 0 0)
(((ss:make-pict-drawer) v) dc 0 0)
(send bm save-file fn 'png)
(make-element #f (list (make-element (make-image-file fn) (list "[image]"))))))]
[(pair? v) (cons (fixup-picts (car v))
(fixup-picts (cdr v)))]
[(serializable? v) v]
[else (make-element value-color (list (format "~s" v)))])))
[else (make-element #f (list (format "~s" v)))])))

View File

@ -42,8 +42,10 @@ positions are initialized with the given @scheme[b]s.
@examples[(bytes 65 112 112 108 101)]}
@defproc[(bytes->immutable-bytes [bstr bytes?]) (and/c bytes?
immutable?)]{ Returns an immutable byte string with the same content
@defproc[(bytes->immutable-bytes [bstr bytes?])
(and/c bytes?
immutable?)]{
Returns an immutable byte string with the same content
as @scheme[bstr], returning @scheme[bstr] itself if @scheme[bstr] is
immutable.}