Fix tabular to satisfy table's contract.

This commit is contained in:
Vincent St-Amour 2014-10-21 12:00:18 -04:00
parent 3568db5f4f
commit 22d9e36150

View File

@ -101,12 +101,20 @@
. cells)
(let* ([rows (length cells)]
[cols (apply =! (map length cells))]
[picts (map elem->pict (append* cells))]
[haligns (for/list ([i (in-range 0 cols)]) halign)]
[valigns (for/list ([i (in-range 0 rows)]) valign)]
[hseps (for/list ([i (in-range 1 cols)]) hgap)]
[vseps (for/list ([i (in-range 1 rows)]) vgap)])
(table cols picts haligns valigns hseps vseps)))
[picts (map elem->pict (append* cells))])
(table cols picts halign valign hgap vgap)))
(module+ test
(void (tabular
(list (colorize (frame (filled-rectangle 8 8)
#:color "black" #:line-width 1)
"white")
(text "Before" '() 7))
(list (colorize (frame (filled-rectangle 8 8)
#:color "black" #:line-width 1)
"Dark Gray")
(text "After" '() 7))
#:gap 5 #:valign cc-superimpose)))
(define (matrixof c)
(and/c (listof (listof c))