On 28 Mar 2007, at 16:32, Gabor Szabo wrote:
The output then can be in YAMLish or whatever but I would like to have
a parser that can generate HTML or whatever tables from this data.
Something like this:

---------------------------
| Name   | IP
| Foo      | 10.1.1.1
---------------------------

As I'll need something like this in the next few days already but I
would like to be forward compatible with YAMLish as much as possible,
how should I do this?

I think the best way would be to make your own code responsible for building the rectangular array of arrays that represents the table. For now format it yourself and output it using diag()

Eventually the dump key of a YAMLish document will be the correct place for this array so instead of this:

 my_tabular_diag( [EMAIL PROTECTED] );

you'll probably do something like this:

 annotate( { dump => [EMAIL PROTECTED] } );

Where 'annotate' is just a name I plucked from the ether - replace with whatever we end up with for 'output to YAML document'.

Then either TAP::Harness will have enough smarts to pretty print rectangular arrays as tables or you'll be able to delegate pretty printing to a helper that knows about tables.

--
Andy Armstrong, hexten.net

Reply via email to