NAME

PFT::Text::Symbol - Symbol from text scan

SYNOPSIS

my $array = PFT::Text::Symbol->scan_html($your_html_text);
foreach (PFT::Text::Symbol->scan_html($your_html_text)) {
    die unless $_->isa('PFT::Text::Symbol')
};

DESCRIPTION

Each instance of PFT::Text::Symbol represents a symbol obtained by parsing the text of an entry PFT::Content::Entry: they are detected as <a> and <img> tags in HTML. Symbols are collected into a a PFT::Text object.

An example will make this easy to understand. Let's consider the following tag:

<img src=":key1:a1/b1/c1">

It will generate a symbol $s1 such that:

$s1->keyword is key1;
$s1->args is the list (a1, b1, c1);
$s1->start points to the first : character;
$s1->len points to the last 1 character;

Since a block of HTML can possibly yield multiple symbols, there's no public construction. Use the scan_html multi-constructor instead.

Construction

Construction usually goes through PFT::Text::Symbol->scan_html, which expects an HTML string as parameter and returns a list of blessed symbols.

For other needs (e.g. testing):

PFT::Text::Symbol->new($keyword, [$arg1, …, $argn], $start, $length)

Properties

keyword
args
start
len