internal package
Foswiki::Tables::Reader
internal package
Foswiki::Tables::Reader
Abstract reader for tables; builds tables using the default table model classes.
The reader is provided with the name of the table_class, which defaults to
Foswiki::Tables::Table. This class provides a
row_class
method which is
used to get the factory for a row (default:
Foswiki::Tables::Row), which in turn
can be interrogated for the
cell_class
(default:
Foswiki::Tables::Cell).
ClassMethod
new($table_class) → $parser
The parser can be used to parse tables from text using
parse
.
ObjectMethod
finish()
Clean up for disposal
ObjectMethod
parse($text [, $topicObject]) → \@list
Extract a topic into a list of lines and embedded table definitions.
Each table definition is an object of type
$table_class
, and contains
a set of attrs (read from the macro) and a list of rows. You can
spot the tables in the list by doing:
if (UNIVERSAL::isa($line, $table_class)) {
text lines are scalars, so will also return false to
ref($line)
The
$topicObject
is an instance of
Foswiki::Meta, and is required to
provide an expansion context for macros embedded in parameters. If it
is not provided, then macros will be passed on unexpanded, and support
for table decorators (such as %EDITTABLE) will be unavailable.