NOTE: SOME FUNCTIONALITY EMPLOYS JAVASCRIPT WASD Documentation Processor – Tables

WASD Documentation Processor

3.Tables

Tables are one of the more demanding document layout requirements. wasDOC table generation largely uses HTML conventions. Note the alternative tags available. The choice between the longer or shorter variants is purely personal (though the shorter make for less clutter in non-trivial tables). The following table is generated using only the following markup elements.

Purpose Syntax
begin table |table|
|tabular|
row of cells |row| ...
|tr| ...
|~ ...
header cell |head| ...
|th| ...
|: ...
data cell |data| ...
|td| ...
|. ...
end table ||
|!table|

Note that rows and cells do not require and must not have closure. This is a deliberate design decision in an effort to reduce the clutter of tags that else seems to accumulate inside tables. Note also that table syntax is very sparse. Again an effort to reduce clutter around the actual data of interest. Further, that table processing removes and compresses white-space around elements in an effort to present "tidier" HTML.

The table above was generated by the following markup text.

|table| |~_ |: Purpose |: Syntax |~ |~#* |. begin table |. |=\|table\|| |^-|=\|tabular\|| |~ |. row of cells |. |=\|row\| ... | |^-|=\|tr\| ... | |^-|=\|~ ... | |~ |. header cell |. |=\|head\| ... | |^-|=\|th\| ... | |~ |. |. |=\|: ... | |~ |. data cell |. |=\|data\| ... | |^-|=\|td\| ... | |^-|=\|. ... | |~ |. end table |. |=\|\|| |^-|=\|!table\|| |!table|

In common with other "block" elements such as lists, tables are indented from the left margin. This may be suppressed using |table-|. The table can be centered on the page using |table><|. The default table alignment may also be set at any time using |set|table=margin=flag|.

Table headings and data are left aligned. Cells can be right and center aligned using |:> and |.>, and |:>< and |.>< respectively. To align an entire row use |~> and |~><, an entire table |table>| and |table><|. (The redundant left alignment is also accepted.)

A cell may have text protected against wrapping by marking it |:>> or |.>>, and an entire row |~>>.

A cell may be underlined by marking it |:_ or |._, and an entire row |~_. Useful for table headings. The table above had the column headings formatted as shown in the markup example.

table row highlight
R...

Note that alternate rows are optionally highlighted to assist in delineating each row's boundary. This highlight is enabled on a per-table basis using #* on a row tag, as with |~#* (or |row#*|, etc.) and subsequently can be disabled in the same table using #!*. A row may explicitly be set to the same highlight as the preceding row using #^*. Any row at all may have a one-shot highlight applied using #1*.

Cells also can have column and row spanning by specifying a digit 2..9 in the tag. The first digit encountered is the column span. Any second digit is the row span. Use 1 for the column span to specify only the row span. To span two columns |.2, to span three rows |.13, and to span four columns and five rows center aligned |.><45.

To suppress the display of a cell use |:# or |.#, and to suppress an entire row |~#. This may actually contain data (see assertion check below) that just will not be visible.

To add a little extra space between the preceding and succeeding rows use |~ (analagous to a line break).

In common with blocks of text, table elements may have specific styling applied. Also see ‘Explicit Styling’ in 2.2 Text Highlight. The tabular example below illustrates the use on a table row.

tabular example

Using the |tabular| tag, tables also can be used to present tabular data where the cells are right aligned and bordered.

(just to check the assertion above) col 1 col 2 col 3
row 1 10 20 30
row 2 400 500 600
row 3 7,000 8,000 9,000

That table was generated by the following markup text:

|tabular| |~ |:# (just to check the assertion above) |: col 1 |: col 2 |: col 3 |~ |: row 1 |. 10 |. 20 |. 30 |~&background-color:gainsboro;. |: row 2 |. 400 |. 500 |. 600 |~ |: row 3 |. 7,000 |. 8,000 |. 9,000 |!tabular|

Also note that the |:# above has a trailing "(just to check the assertion above)" which is not visible (check the HTML source if requiring verification).

Chapter Links