3.12 Skribe User Manual -- Table

Tables are defined by the means of the table function.

prototype
(table [:ident] [:class] [:border] [:width] [:frame 'none] [:rules 'none] [:cellstyle 'collapse] [:cellpadding] [:cellspacing] row...)
optionenginesdescription
identhtml latex xml The node identifier.
classhtml latex xml The node class.
borderhtml The table border thickness.
widthhtml latex The width of the table.
framehtml latex Which parts of frame to render. Must be one of none, above, below, hsides, vsides, lhs, rhs, box, border.
ruleshtml latex Rulings between rows and cols, Must be one of none, rows, cols, header, all.
cellstylehtml latex The style of cells border. Must be either collapse, separate, or a length representing the horizontal and vertical space separating the cells.
cellpaddinghtml A number of pixels around each cell.
cellspacinghtml An optional number of pixels used to separate each cell of the table. A negative uses the target default.
argumentdescription
row...The rows of the table. Each row must be constructed by the trtr function.

Note: Tables rendering may be only partially supported by graphical agents. For instance, the cellstyle attribute is only supported by HTML engines supporting CSS2.

3.12.1 Table row

Table rows are defined by the tr function.

prototype
(tr [:ident] [:class] [:bg] cell...)
optionenginesdescription
identhtml latex xml The node identifier.
classhtml latex xml The node class.
bghtml The background color of the row.
argumentdescription
cell...The row cells.

3.12.2 Table cell

Two functions define table cells: th for header cells and td for plain cells.

prototype
(th [:ident] [:class] [:width] [:align 'center] [:valign] [:colspan 1] [:bg] node)
(td [:ident] [:class] [:width] [:align 'center] [:valign] [:colspan 1] [:bg] node)
optionenginesdescription
identhtml latex xml The node identifier.
classhtml latex xml The node class.
bghtml The background color of the cell.
widthhtml latex The width of the table.
alignhtml latex The horizontal alignment of the table cell (left, right, or center. Some engines, such as the HTML engine, also supports a character for the alignment.)
valignhtml latex The vertical alignment of the cell. The value can be top, center, bottom.
colspanhtml latex The number of columns that the cell expands to.
argumentdescription
nodeThe value of the cell.

3.12.3 Example

Example:
(center
   (table :border 1 :width 50. :frame 'hsides :cellstyle 'collapse
      (tr :bg "#cccccc" (th :align 'center :colspan 3 "A table"))
      (tr (th "Col 1") (th "Col 2") (th "Col 3"))
      (tr (td :align 'center "10") (td "-20") (td "30"))
      (tr (td :align 'right :rowspan 2 :valign 'center "12") (td "21"))
      (tr (td :align 'center :colspan 2 "1234"))
      (tr (td :align 'center :colspan 2 "1234") (td :align 'right "5"))
      (tr (td :align 'center :colspan 1 "1") (td :colspan 2 "2345"))))
Ex. 16: A table

Produces:

A table
Col 1Col 2Col 3
10-2030
1221
1234
12345
12345

This Html page has been produced by Skribe.
Last update Tue Jun 29 09:37:13 2010.