aboutsummaryrefslogtreecommitdiff
path: root/doc/plugins/contrib/table.mdwn
blob: 6497557192064b05f982c2bb6c513d16002bdce5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
[[meta title="table (third-party plugin)"]]

This plugin allows build html tables from data in csv (comma-separated values) or dsv (delimiter-separated values) formats.

It need the perl module [[cpan Text::CSV]] for the csv data. 

## usage

In any source page include the following:

    The next table show the results:

    \[[table class="myclass" format=dsv data="""
    Custom|Amount|
    Fulanito|134,34|
    Menganito|234,56|
    """]]

    This is my last acquisition:

    [[table class="book_record" format=csv file="data/books/record1"]]

    And the record1 page should be similar to:

    "Title","Perl Best Practices"
    "Author","Damian Conway"
    "Publisher","O’Reilly"

The parameters are:

- _data_: Contains the values for the table
- _file_: Wiki page whom contains the data.
- _format_ (optional): format name of the data. By default is `auto` and the options are `csv` or `dsv`.
- _delimiter_ (optional): Define the character used for separated the fields. By default is the vertical barr "|" in DSV format and the comma "," for the CSV format.
- _class_ (optional):  CSS class for the table html element
- _caption_ (optional):   Text string with the table caption.
- _no\_header_: This switch disable the generation of table header elements. By default this switch is enabled, and the header cells come from the firts data line.

Obviously, the _data_ and _file_ parameters are mutually exclusive. 

Note: the format detection mechanism is still very rudimentary. 

## Changelog

### version 0.5

* Remove a call to a inexistent Text::CSV method.
* Added the sep_char parameter.
* Parse CVS data in binary mode.
* Added a format detection mechanism.
* Default format now is 'auto'.

## Links

- Information about the formats in Wikipedia:
    - [[wikipedia CSV]]
    - [[wikipedia DSV]]

- Download of the tar file from <http://taquiones.net/files/misc/>
- Debian package in <http://taquiones.net/files/debian/>