chickadee » html-utils » tabularize

tabularize items #!key table-id table-class quote-procedure even-row-class odd-row-class headerprocedure

Generates an HTML table from items (a list of lists). The following keyword parameters may be used:

  • table-id: the value for the HTML id attribute for the table.
  • table-class: the value for the HTML class attribute for the table.
  • quote-procedure: an one-argument procedure to specify the quoting of attributes' values for tags.
  • even-row-class: the value for the HTML class attribute for even rows of the the table.
  • odd-row-class: the value for the HTML class attribute for odd rows of the the table.
  • header: a list of column names to be used as the table header (enclosed by the th tag).
  • thead/tbody: if #t, generates the table with <thead> and <tbody> tags.

Examples:

(tabularize '((1 2 3) (4 5 6)))

Produces:

"<table><tr><td>1</td><td>2</td><td>3</td></tr><tr><td>4</td><td>5</td><td>6</td></tr></table>"
(tabularize '((1 2 3) (4 5 6)) table-id: "test" even-row-class: "yellow" odd-row-class: "blue")

Produces:

"<table id='test'><tr class='yellow'><td>1</td><td>2</td><td>3</td></tr><tr class='blue'><td>4</td><td>5</td><td>6</td></tr></table>"