Thomas Hartman wrote:
I was playing with Text.XHtml.Table but couldn't use it to output tables.
( cell . toHtml $ a ) `beside` (cell . toHtml $ b )
tr
a b /tr
already seems wrong -- should be two cells, right? And the result
doesn't get embedded in a table tag?
'cell' is not a TD element, it's an abstraction used to manage cells and
deal with arbitrary numbers of rows and columns. You won't normally use
'cell' directly, but it gets used when laying out a table.
Here's a simple two-cell table:
table (td a ) `beside` (td b )
TABLE
TR
TD
a
/TD
TD
b
/TD
/TR
/TABLE
Note that 'beside' has an infix version, -. 'above' also has an infix
version, /. So here's a 2x2 table:
table (td a - td b
/ td c - td d)
(I haven't included the HTML output, but it works.)
To see what 'cell' does, we can create a table with cell widths and
heights other than 1. In GHCi:
let twoDown = (td a / td b)
let threeAcross = (td d - td e - td f)
let threeDown = (td g / td h / td i)
let oneTopTwoBottom = (td j / td k - td l)
table (twoDown - threeAcross - threeDown - oneTopTwoBottom)
The 'cell' function doesn't get called explicitly above, but it gets
used internally. Try it, the results are fairly self-explanatory.
Anton
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe