]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/plugins/contrib/table.mdwn
web commit by JoshTriplett: Formatting, typos, and wording.
[git.ikiwiki.info.git] / doc / plugins / contrib / table.mdwn
1 [[meta title="table (third-party plugin)"]]
3 This plugin supplies a `table` [[PreprocessorDirective]] to build html tables from data in CSV (comma-separated values) or DSV (delimiter-separated values) format.
5 It needs the perl module [[cpan Text::CSV]] for the CSV data.
7 ## Usage
9 In any source page include the following:
11     The next table shows the results:
13     \[[table class="myclass" format=dsv data="""
14     Custom|Amount|
15     Fulanito|134,34|
16     Menganito|234,56|
17     """]]
19     This is my last acquisition:
21     [[table class="book_record" format=csv file="data/books/record1"]]
23     And the record1 page should be similar to:
25     "Title","Perl Best Practices"
26     "Author","Damian Conway"
27     "Publisher","O’Reilly"
29 The parameters are:
31 - _data_: Values for the table
32 - _file_: Wiki page containing the data.
33 - _format_ (optional): format name of the data. By default is `auto` and the options are `csv` or `dsv`.
34 - _delimiter_ (optional): The character used to separate fields. By default, DSV format uses a pipe (`|`), and CSV uses a comma (`,`).
35 - _class_ (optional): CSS class for the table html element
36 - _caption_ (optional): Text string for the table caption.
37 - _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 The _data_ and _file_ parameters are mutually exclusive.
41 Note: the automatic format detection mechanism is still very rudimentary.
43 ## Changelog
45 ### version 0.5
47 * Remove a call to an inexistent [[cpan Text::CSV]] method.
48 * Added the sep_char parameter.
49 * Parse CSV data in binary mode.
50 * Added a format detection mechanism.
51 * Default format now is 'auto'.
53 ## Links
55 - Information about the formats in Wikipedia:
56     - [[wikipedia CSV]]
57     - [[wikipedia DSV]]
59 - Download the tar file from <http://taquiones.net/files/misc/>
60 - Debian package in <http://taquiones.net/files/debian/>