internal package Foswiki::Tables::Reader
See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

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.

Topic revision: r1 - 21 Nov 2014, ProjectContributor
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback