]> sipb.mit.edu Git - ikiwiki.git/blob - doc/ikiwiki/directive/table.mdwn
Merge branch 'master' of ssh://git.ikiwiki.info
[ikiwiki.git] / doc / ikiwiki / directive / table.mdwn
1 The `table` directive is supplied by the [[!iki plugins/table desc=table]] plugin.
2
3 This directive can build HTML tables from data in CSV (comma-separated values)
4 or DSV (delimiter-separated values) format.
5
6 ## examples
7
8         \[[!table data="""
9         Customer |Amount
10         Fulanito |134,34
11         Menganito|234,56
12         Menganito|234,56
13         """]]
14     
15         \[[!table class="book_record" format=csv file="data/books/record1"]]
16
17 In this second example the `record1` page should be similar to:
18
19         "Title","Perl Best Practices"
20         "Author","Damian Conway"
21         "Publisher","O’Reilly"
22
23 To make a cell span multiple columns, follow it with one or more empty
24 cells. For example:
25
26         \[[!table data="""
27         left||right|
28         a|b|c|d
29         this cell spans **4** columns|||
30         """]]
31
32 ## usage
33
34 * `data` - Values for the table.
35 * `file` - A file in the wiki containing the data.
36 * `format` - The format of the data, either "csv", "dsv", or "auto"
37   (the default).
38 * `delimiter` - The character used to separate fields. By default,
39    DSV format uses a pipe (`|`), and CSV uses a comma (`,`).
40 * `class` - A CSS class for the table html element.
41 * `header` - By default, or if set to "row", the first data line is used
42   as the table header. Set it to "no" to make a table without a header, or
43   "column" to make the first column be the header.
44
45 For tab-delimited tables (often obtained by copying and pasting from HTML
46 or a spreadsheet), `delimiter` must be set to a literal tab character. These
47 are difficult to type in most web browsers - copying and pasting one from
48 the table data is likely to be the easiest way.
49
50 Note that the contents of table cells can contain arbitrary ikiwiki and
51 markdown markup.
52
53 [[!meta robots="noindex, follow"]]