Finish table documentation.

This commit is contained in:
Dominik Pantůček 2023-03-23 20:09:46 +01:00
parent 85354ef0fa
commit 4804d2f84c

View file

@ -621,6 +621,7 @@ substituted.
[#:border-style (*table-border-style*)]
[#:ansi #f])
* ```tbl``` - list of lists with cell data
* ```#:table-border``` - if ```#t```, the table has outer border
* ```#:row-border``` - if ```#t```, the rows are separated by borders
* ```#:col-border``` - if ```#t```, the columns are separated by borders
@ -629,3 +630,26 @@ substituted.
* ```#:ansi``` - if ```#t```, all cell line strings are terminated
with ```a:default```
The table ```tbl``` is represented as a list of rows where each row is
a list of cells that hold arbitrary values that are converted to
string when rendering the table.
Before rendering the table, the following steps are performed:
* The table is made rectangular - that is all rows are extended by
empty strings to have the same length.
* All non-string cells are converted to string using ```sprintf```
* All cells are split into list of strings representing the lines of
text inside them.
* For each row, all cells are extended by empty strings to have
matching number of lines of text inside them.
* For each column, all lines of text inside all of the cells are
padded with spaces to have uniform width.
Then each table row is converted to list of strings adding column
separators and table borders as required. These lists are then joined
with row separators and possibly prefixed and suffixed by top and
bottom table border.
The resulting list of strings is joined with newline character as the
separator.