]> sipb.mit.edu Git - ikiwiki.git/blob - doc/plugins/contrib/table.mdwn
* Allow plugins to add new types of tests that can be used in PageSpecs.
[ikiwiki.git] / doc / plugins / contrib / table.mdwn
1 [[template id=plugin name=table author="[[VictorMoral]]"]]
2 [[tag type/format]]
3
4 This plugin supplies a `table` [[PreprocessorDirective]] to build html tables from data in CSV (comma-separated values) or DSV (delimiter-separated values) format.
5
6 It needs the perl module [[cpan Text::CSV]] for the CSV data.
7
8 ## Usage
9
10 In any source page include the following:
11
12     The next table shows the results:
13
14     \[[table class="myclass" format=dsv data="""
15     Custom|Amount|
16     Fulanito|134,34|
17     Menganito|234,56|
18     """]]
19
20     This is my last acquisition:
21
22     [[table class="book_record" format=csv file="data/books/record1"]]
23
24     And the record1 page should be similar to:
25
26     "Title","Perl Best Practices"
27     "Author","Damian Conway"
28     "Publisher","O’Reilly"
29
30 The parameters are:
31
32 - _data_: Values for the table
33 - _file_: Wiki page containing the data.
34 - _format_ (optional): format name of the data. By default is `auto` and the options are `csv` or `dsv`.
35 - _delimiter_ (optional): The character used to separate fields. By default, DSV format uses a pipe (`|`), and CSV uses a comma (`,`).
36 - _class_ (optional): CSS class for the table html element
37 - _caption_ (optional): Text string for the table caption.
38 - _no\_header_: This switch disables the generation of table header (`<th>`) elements. By default, the `table` directive uses the first data line as column headers.
39
40 The _data_ and _file_ parameters are mutually exclusive.
41
42 Note: the automatic format detection mechanism is still very rudimentary.
43
44 ## Changelog
45
46 ### version 0.5
47
48 * Remove a call to an inexistent [[cpan Text::CSV]] method.
49 * Added the sep_char parameter.
50 * Parse CSV data in binary mode.
51 * Added a format detection mechanism.
52 * Default format now is 'auto'.
53
54 ## Links
55
56 - Information about the formats in Wikipedia:
57     - [[wikipedia CSV]]
58     - [[wikipedia DSV]]
59
60 - Download the tar file from <http://taquiones.net/files/misc/>
61 - Debian package in <http://taquiones.net/files/debian/>