.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Parse::BBCode::Tag 3pm" .TH Parse::BBCode::Tag 3pm "2021-01-06" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Parse::BBCode::Tag \- Tag Class for Parse::BBCode .SH "DESCRIPTION" .IX Header "DESCRIPTION" If you parse a bbcode with Parse::BBCode \f(CW\*(C`Parse::BBCode::parse\*(C'\fR returns a parse tree of Tag objects. .SH "METHODS" .IX Header "METHODS" .IP "add_content" 4 .IX Item "add_content" .Vb 1 \& $tag\->add_content(\*(Aqstring\*(Aq); .Ve .Sp Adds 'string' to the end of the tag content. .Sp .Vb 1 \& $tag\->add_content($another_tag); .Ve .Sp Adds \f(CW$another_tag\fR to the end of the tag content. .IP "raw_text" 4 .IX Item "raw_text" .Vb 1 \& my $bbcode = $tag\->raw_text; .Ve .Sp Returns the raw text of the parse tree, so all tags are converted back to bbcode. .IP "raw_content" 4 .IX Item "raw_content" .Vb 1 \& my $bbcode = $tag\->raw_content; .Ve .Sp Returns the raw content of the tag without the opening and closing tags. So if you have tag that was parsed from .Sp .Vb 1 \& [i]italic and [bold]test[/b][/i] .Ve .Sp it will return .Sp .Vb 1 \& italic and [bold]test[/b] .Ve .IP "walk" 4 .IX Item "walk" Utility to do a breadth first search ('bfs') over the parsed tree. .Sp .Vb 5 \& $tag\->walk(\*(Aqbfs\*(Aq, sub { \& # tag is in $_ \& ... \& return 0; \& }); .Ve .Sp When the sub returns 1 it stops walking the tree. Useful for finding a certain tag. .SH "ACCESSORS" .IX Header "ACCESSORS" The accessors of a tag are currently .PP .Vb 1 \& name attr attr_raw content finished start end close class .Ve .PP You can call each accessor with \f(CW\*(C`get_*\*(C'\fR and \f(CW\*(C`set_*\*(C'\fR .IP "name" 4 .IX Item "name" The tag name. for \f(CW\*(C`[i]...[/i]\*(C'\fR it is \f(CW\*(C`i\*(C'\fR, the lowercase tag name. .IP "attr" 4 .IX Item "attr" \&\s-1TODO\s0 .IP "attr_raw" 4 .IX Item "attr_raw" The raw text of the attribute .IP "content" 4 .IX Item "content" An arrayref of the content of the tag, each element either a string or a tag itself. .IP "finished" 4 .IX Item "finished" Used during parsing, true if the end of the tag was found. .IP "start" 4 .IX Item "start" The original start string, e.g. '\f(CW\*(C`[size=7]\*(C'\fR' .IP "end" 4 .IX Item "end" The original end string, e.g. '\f(CW\*(C`[/size]\*(C'\fR' .IP "close" 4 .IX Item "close" True if the tag needs a closing tag. A tag which doesn't need a closing tag is \f(CW\*(C`[*]\*(C'\fR for example, inside of \f(CW\*(C`[list]\*(C'\fR tags. .IP "class" 4 .IX Item "class" \&'block', 'inline' or 'url' .IP "single" 4 .IX Item "single" If this tag does not have a closing tag and also no content, like [hr], for example, set this to true. Default is 0. .IP "num" 4 .IX Item "num" Absolute number of tag with this name in the tree. Useful if you want to number code tags and offer download links. .IP "level" 4 .IX Item "level" Level of tag .Sp For the tag [u] in the following bbcode .Sp .Vb 1 \& [b]bold [i]italic [u]underlined[/u][/i][/b] .Ve .Sp it returns 3.