Not Marpa related, but anyway: Announce Text::Table::Manifold

13 views
Skip to first unread message

Ron Savage

unread,
Jan 31, 2015, 11:11:49 PM1/31/15
to marpa-...@googlegroups.com

Outputs tables in any one of several supported types.

Features:

o Generic interface to all supported table formats
o Separately specify header/data/footer rows
o Separately include/exclude header/data/footer rows
o Align cell values

Each column has its own alignment option, left, center or right.

For internally generated HTML, this is done with a CSS div within each td, not with the obsolete td align attribute.

But decimal places are not alignable, yet, as discussed in the "TODO".

o Escape HTML entities or URIs

But not both at the same time!

o Extend short header/data/footer rows with empty strings or undef

Auto-extension results in all rows being the same length.

This takes place before the transformation, if any, mentioned next.

o Tranform cell values which are empty strings and undef
o Pad cell values
o Handle UFT8
o Return the table as an arrayref of lines or as a string

The arrayref is returned by "render([%hash])", and the string by "render_as_string([%hash])".

When returning a string by calling render_as_string() (which calls render()), you can specify how the lines in the arrayref are joined.

In the same way the format parameter discussed just below controls the output, the join parameter controls the join.

The format of the output is controlled by the format parameter to new(), or by the parameter to the "format([$format])" method, or by the value of the format key in the hash passed to "render([%hash])" and "render_as_string(%hash])", and must be one of these imported constants:

o format_internal_boxed

All headers, footers and table data are surrounded by ASCII characters.

The rendering is done internally.

See scripts/internal.boxed.pl and output file data/internal.boxed.log.

o format_internal_github

Render as github-flavoured markdown.

The rendering is done internally.

See scripts/internal.github.pl and output file data/internal.github.log.

o format_internal_html

Render as a HTML table. You can use the "pass_thru([$hashref])" method to set options for the HTML table.

The rendering is done internally.

See scripts/internal.html.pl and output file data/internal.html.log.

o format_html_table

Passes the data to HTML::Table. You can use the "pass_thru([$hashref])" method to set options for the HTML::Table object constructor.

Warning: You must use Text::Table::Manifold's data() method, or the data parameter to new(), and not the -data option to HTML::Table. This is because the module processes the data before calling the HTML::Table constructor.

o format_text_csv

Passes the data to Text::CSV. You can use the "pass_thru([$hashref])" method to set options for the Text::CSV object constructor.

See scripts/text.csv.pl and output file data/text.csv.log.

o format_text_unicodebox_table

Passes the data to Text::UnicodeBox::Table. You can use the "pass_thru([$hashref])" method to set options for the Text::UnicodeBox::Table object constructor.

See scripts/text.unicodebox.table.pl and output file data/text.unicodebox.table.log.

See also scripts/synopsis.pl, and the output data/synopsis.log.


Ruslan Shvedov

unread,
Feb 2, 2015, 12:32:32 AM2/2/15
to marpa-...@googlegroups.com
Impressive work, congratulations are in order.

--
You received this message because you are subscribed to the Google Groups "marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email to marpa-parser...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ron Savage

unread,
Feb 2, 2015, 1:42:25 AM2/2/15
to marpa-...@googlegroups.com
$many x $thanx;

Ruslan Shvedov

unread,
Feb 2, 2015, 3:13:45 AM2/2/15
to marpa-...@googlegroups.com
Absolutely welcome. As an aside, can't find the link to the script that tests your Marpa modules and print nice statistics, e.g. "Test statistics: ... Fail: ... " -- is it online?

On Mon, Feb 2, 2015 at 8:42 AM, Ron Savage <r...@savage.net.au> wrote:
$many x $thanx;

Ron Savage

unread,
Feb 2, 2015, 3:35:01 PM2/2/15
to marpa-...@googlegroups.com
It wasn't, but is now at savage.net.au/Perl/test.marpa.pl. Check line 42 for the dir structure.


Ruslan Shvedov

unread,
Feb 3, 2015, 12:06:11 AM2/3/15
to marpa-...@googlegroups.com
Great, thanks a lot!

On Mon, Feb 2, 2015 at 10:35 PM, Ron Savage <r...@savage.net.au> wrote:
It wasn't, but is now at savage.net.au/Perl/test.marpa.pl. Check line 42 for the dir structure.


Reply all
Reply to author
Forward
0 new messages