Parse::BBCode::Tag(3pm) | User Contributed Perl Documentation | Parse::BBCode::Tag(3pm) |
Parse::BBCode::Tag - Tag Class for Parse::BBCode
If you parse a bbcode with Parse::BBCode "Parse::BBCode::parse" returns a parse tree of Tag objects.
$tag->add_content('string');
Adds 'string' to the end of the tag content.
$tag->add_content($another_tag);
Adds $another_tag to the end of the tag content.
my $bbcode = $tag->raw_text;
Returns the raw text of the parse tree, so all tags are converted back to bbcode.
my $bbcode = $tag->raw_content;
Returns the raw content of the tag without the opening and closing tags. So if you have tag that was parsed from
[i]italic and [bold]test[/b][/i]
it will return
italic and [bold]test[/b]
$tag->walk('bfs', sub { # tag is in $_ ... return 0; });
When the sub returns 1 it stops walking the tree. Useful for finding a certain tag.
The accessors of a tag are currently
name attr attr_raw content finished start end close class
You can call each accessor with "get_*" and "set_*"
For the tag [u] in the following bbcode
[b]bold [i]italic [u]underlined[/u][/i][/b]
it returns 3.
2022-06-16 | perl v5.34.0 |