Debian Codegraph @

README

raw
1 NAME
2
3 Catmandu::Exporter::Table - ASCII/Markdown table exporter
4
5 SYNOPSIS
6
7 With catmandu command line client:
8
9 echo '{"one":"my","two":"table"} {"one":"is","two":"nice"}' | \
10 catmandu convert JSON --multiline 1 to Table
11 | one | two |
12 |-----|-------|
13 | my | table |
14 | is | nice |
15
16 catmandu convert CSV to Table --fields id,name --columns ID,Name < sample.csv
17 | ID | Name |
18 |----|------|
19 | 23 | foo |
20 | 42 | bar |
21 | 99 | doz |
22
23 In Perl scripts:
24
25 use Catmandu::Exporter::Table;
26 my $exp = Catmandu::Exporter::Table->new;
27 $exp->add({ title => "The Hobbit", author => "Tolkien" });
28 $exp->add({ title => "Where the Wild Things Are", author => "Sendak" });
29 $exp->add({ title => "One Thousand and One Nights" });
30 $exp->commit;
31
32 | author | title |
33 |---------|-----------------------------|
34 | Tolkien | The Hobbit |
35 | Sendak | Where the Wild Things Are |
36 | | One Thousand and One Nights |
37
38 DESCRIPTION
39
40 This Catmandu::Exporter exports data in tabular form, formatted in
41 MultiMarkdown syntax.
42
43 The output can be used for simple display, for instance to preview
44 Excel files on the command line. Use Pandoc
45 <http://johnmacfarlane.net/pandoc/> too further convert to other table
46 formats, e.g. latex, html5, mediawiki:
47
48 catmandu convert XLS to Table < sheet.xls | pandoc -t html5
49
50 By default columns are sorted alphabetically by field name.
51
52 CONFIGURATION
53
54 Table output can be controlled with the options fields, columns,
55 widths, and condense as documented in Text::MarkdownTable.
56
57 file
58
59 fh
60
61 encoding
62
63 fix
64
65 Standard options of Catmandu:Exporter
66
67 condense
68
69 Write table in condense format with unaligned columns.
70
71 fields
72
73 Field names as comma-separated list or array reference.
74
75 columns
76
77 Column names as comma-separated list or array reference. By default
78 field names are used as column names.
79
80 header
81
82 Include header lines. Enabled by default.
83
84 widths
85
86 Column widths as comma-separated list or array references. Calculated
87 from all rows by default. Long cell values can get truncated with
88 this option.
89
90 schema
91
92 Supply fields and (optionally) columns in a JSON Table Schema
93 <http://dataprotocols.org/json-table-schema/> as JSON file or hash
94 reference having the following structure:
95
96 {
97 "fields: [
98 { "name": "field-name-1", "title": "column title 1 (optional)" },
99 { "name": "field-name-2", "title": "column title 2 (optional)" },
100 ...
101 ]
102 }
103
104 METHODS
105
106 See Catmandu::Exporter
107
108 SEE ALSO
109
110 This module is based on Text::MarkdownTable.
111
112 Similar Catmandu Exporters for tabular data include
113 Catmandu::Exporter::CSV, Catmandu::Exporter::XLS, and
114 Catmandu::Exporter::XLSX.
115