]> sipb.mit.edu Git - ikiwiki.git/blob - doc/plugins/table.mdwn
* table plugin: Actually specify the delimiter.
[ikiwiki.git] / doc / plugins / table.mdwn
1 [[template id=plugin name=table author="[[VictorMoral]]"]]
2 [[tag type/format]]
3
4 This plugin can build HTML tables from data in CSV (comma-separated values)
5 or DSV (delimiter-separated values) format.
6
7 It needs the perl module [[cpan Text::CSV]] for the CSV data.
8
9 [[table data="""
10 "foo",[[joey]],"bar"
11 "bar",[[joeyno]], foo"
12 """]]
13
14 [[table data="""
15 foo|[[joey]]|bar
16 bar|[[joeyno]]|foo
17 """]]
18
19 ## examples
20
21         \[[table data="""
22         Customer|Amount
23         Fulanito|134,34
24         Menganito|234,56
25         Menganito|234,56
26         """]]
27     
28         \[[table class="book_record" format=csv file="data/books/record1"]]
29
30 In this second example the `record1` page should be similar to:
31
32         "Title","Perl Best Practices"
33         "Author","Damian Conway"
34         "Publisher","O’Reilly"
35
36 To make a cell span multiple columns, follow it with one or more empty
37 cells. For example:
38
39         \[[table data="""
40         left||right|
41         a|b|c|d
42         this cell spans 4 columns|||
43         """]]
44
45 ## usage
46
47 * `data` - Values for the table.
48 * `file` - A file in the wiki containing the data.
49 * `format` - The format of the data, either "csv", "dsv", or "auto"
50   (the default).
51 * `delimiter` - The character used to separate fields. By default,
52    DSV format uses a pipe (`|`), and CSV uses a comma (`,`).
53 * `class` - A CSS class for the table html element.
54 * `header` - Set to "no" to make a table without a header. By default,
55   the first data line is used as the table header.