
XAO::DO::Web::TextTable - plain text tables

<%TextTable mode="start"
format=" l | r | l "
%>
<%TextTable mode="head"
cell.1.template="Name"
cell.2.template="Price"
cell.3.template="Description"
%>
<%TextTable mode="ruler" symbol="-"%>
<%TextTable cell.1.template="Fubar"
cell.2.template={<%Styler/f dollars="123.34"%>}
cell.3.path="/bits/show-description
cell.3.ID="123456"
%>
<%TextTable mode="render" width="70"%>

Web::TextTable object allows to create simple pre-formatted text only tables out of various dynamic content. It currently uses David Schweikert's Text::FormatTable module internally.
Due to rendering requirements generating a table is a multi-step process:
mode => 'start' format => format string as descriped in L<Text::FormatTable>
Modes for 'row' and 'head' take the same arguments and currently display exactly the same results:
mode => 'head' or 'row'
cell.X.template => inline template for cell X of the row (see below)
cell.X.path => path to a template
cell.X.pass => pass all current arguments to the template
cell.X.VAR => make 'VAR' available to the template with the given
content
Here 'X' may be anything as long as alphanumerically ordered cell.*.* lines give exactly the required number of columns. It is recommended to use single digits in incrementing order to designate rows:
<%TextTable mode="head"
cell.1.template="Fubar"
cell.2.path="/bits/show-price"
cell.2.PRICE="123.23"
cell.3.path="/bits/show-description
cell.3.ID="123456"
%>
For 'ruler' mode the only optional argument is 'symbol' - what symbol to use to draw the ruler. The default is '-'.
<%TextTable mode="render"%>
Tables can be nested as long as there is a 'render' for each 'start'.
Internally Web::TextTable uses clipboard variable located at '/var/TextTable'.
Note: You need to be careful with extra spaces and newlines. One way of dealing with it is to enclose table preparation into an unused variable brackets to just throw away extra space:
<%SetArg name="UNUSED" value={ <%TextTable ....%> <%TextTable ....%> <%TextTable ....%> }%><%TextTable mode="render"%>

Copyright (c) 2005 Andrew Maltsev
Copyright (c) 2001-2004 Andrew Maltsev, XAO Inc.
<am@ejelta.com> -- http://ejelta.com/xao/

Recommended reading: XAO::Web, Text::FormatTable.