| 1 |
NAME |
| 2 |
Text::MarkdownTable - Write Markdown syntax tables from data |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
my $table = Text::MarkdownTable->new; |
| 6 |
$table->add({one=>"a",two=>"table"}); |
| 7 |
$table->add({one=>"is",two=>"nice"}); |
| 8 |
$table->done; |
| 9 |
|
| 10 |
| one | two | |
| 11 |
|-----|-------| |
| 12 |
| a | table | |
| 13 |
| is | nice | |
| 14 |
|
| 15 |
Text::MarkdownTable->new( columns => ['X','Y','Z'], edges => 0 ) |
| 16 |
->add({a=>1,b=>2,c=>3})->done; |
| 17 |
|
| 18 |
X | Y | Z |
| 19 |
--|---|-- |
| 20 |
1 | 2 | 3 |
| 21 |
|
| 22 |
DESCRIPTION |
| 23 |
This module can be used to write data in tabular form, formatted in |
| 24 |
MultiMarkdown syntax. The resulting format can be used for instance to |
| 25 |
display CSV data or to include data tables in Markdown files. Newlines |
| 26 |
and vertical bars in table cells are replaced by a space character and |
| 27 |
cell values can be truncated. |
| 28 |
|
| 29 |
CONFIGURATION |
| 30 |
file |
| 31 |
Filename, GLOB, scalar reference or IO::Handle to write to (default |
| 32 |
STDOUT). |
| 33 |
|
| 34 |
fields |
| 35 |
Array, hash reference, or comma-separated list of fields/columns. |
| 36 |
|
| 37 |
columns |
| 38 |
Column names. By default field names are used. |
| 39 |
|
| 40 |
widths |
| 41 |
Column widths. By default column widths are calculated automatically |
| 42 |
to the width of the widest value. With given widths, the table is |
| 43 |
directly be written without buffering and large table cell values |
| 44 |
are truncated. |
| 45 |
|
| 46 |
header |
| 47 |
Include header lines. Enabled by default. |
| 48 |
|
| 49 |
edges |
| 50 |
Include border before first column and after last column. Enabled by |
| 51 |
default. Note that single-column tables don't not look like tables |
| 52 |
if edges are disabled. |
| 53 |
|
| 54 |
condense |
| 55 |
Write table unbuffered in condense format: |
| 56 |
|
| 57 |
one|two |
| 58 |
---|--- |
| 59 |
a|table |
| 60 |
is|nice |
| 61 |
|
| 62 |
Note that single-column tables are don't look like tables on |
| 63 |
condense format. |
| 64 |
|
| 65 |
METHODS |
| 66 |
add( $row ) |
| 67 |
Add a row as hash reference. Returns the table instance. |
| 68 |
|
| 69 |
streaming |
| 70 |
Returns whether rows are directly written or buffered until "done" |
| 71 |
is called. |
| 72 |
|
| 73 |
done |
| 74 |
Finish and write the table unless it has already been written in |
| 75 |
"streaming" mode. |
| 76 |
|
| 77 |
SEE ALSO |
| 78 |
See Catmandu::Exporter::Table for an application of this module that can |
| 79 |
be used to easily convert data to Markdown tables. |
| 80 |
|
| 81 |
Similar table-generating modules include: |
| 82 |
|
| 83 |
Text::Table::Tiny |
| 84 |
Text::TabularDisplay |
| 85 |
Text::SimpleTable |
| 86 |
Text::Table |
| 87 |
Text::ANSITable |
| 88 |
Text::ASCIITable |
| 89 |
Text::UnicodeBox::Table |
| 90 |
Table::Simple |
| 91 |
Text::SimpleTable |
| 92 |
Text::SimpleTable::AutoWidth |
| 93 |
|
| 94 |
AUTHOR |
| 95 |
Jakob Voß <[email protected]> |
| 96 |
|
| 97 |
COPYRIGHT AND LICENSE |
| 98 |
Copyright 2014- Jakob Voß |
| 99 |
|
| 100 |
This library is free software; you can redistribute it and/or modify it |
| 101 |
under the same terms as Perl itself. |
| 102 |
|