01 Oct 2001 03:55:19 UTC
- Distribution: HTML-WebMake
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (60 / 244 / 0)
- KwaliteeBus factor: 0
- 10.37% Coverage
- License: unknown
- Activity24 month
- Download (546.35KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
csvtable_tag.wmk - define a HTML table using comma-separated values
< use plugin="csvtable_tag" />
< csvtable [delimiter="char"] [HTML table attributes] > [...cells...] < /csvtable >
This WebMake Perl library provides a tag to allow HTML tables to be constructed, quickly, using a tab-, comma-, or pipe-separated value table.
Firstly, pick a delimiter character, such as
|. Set the
delimiterattribute to this character.
Each line of the CSV table will become a < TR >; each delimiter-separated cell will be enclosed in a < TD > tag pair.
Attributes for the HTML table tag itself, can be provided as attributes to this tag; they will be passed through into the resulting < TABLE > tag.
By default, items inside the tables are represented as < TD > cells, with no attributes. Certain special line prefixes allow control over formatting of table items, as follows. These are all case-insensitive, and whitespace after them will be stripped; but they must start on the first character of the line (no leading spaces), and, despite how they're rendered here, should not contain any spaces between the angle brackets.
Blank lines are skipped.
- < !-- .... -- >
Comments, a la HTML.
- < csvfmt >
The rest of the line is used to specify the format to be used for each line afterwards, until the end of the < csvtable >, or until the next < csvfmt > line.
The line should end in a < /csvfmt > closing tag.
Specify a < tr >...< /tr > block, with $1, $2, $3, etc. for the numbered cells (counting from 1). For example:
< csvfmt >< tr >< td >$1< /td >< td >$2< /td >< td >$3< /td >< /tr >< /csvfmt >
< csvtable delimiter="|" > < !-- heading -- > < csvfmt >< tr >< th >$1< /th >< th >$2< /th >< th >$3< /th >< /tr ></ csvfmt > First Name|Surname|Title < !-- contents -- > < csvfmt >< tr >< td >$1< /td >< td >$2< /td >< td >$3< /td >< /tr ></ csvfmt > Justin|Mason|JAPH Foo|Bar|Baz < /csvtable >
Thanks to Chris Barrett; he suggested this tag.
Module Install Instructions
To install HTML::WebMake, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install HTML::WebMake
For more information on module installation, please visit the detailed CPAN module installation guide.