NAME Tags::HTML::Tree - Tags helper for Tree. SYNOPSIS use Tags::HTML::Tree; my $obj = Tags::HTML::Tree->new(%params); $obj->cleanup; $obj->init($tree); $obj->prepare; $obj->process; $obj->process_css; METHODS "new" my $obj = Tags::HTML::Tree->new(%params); Constructor. * "css" 'CSS::Struct::Output' object for process_css processing. Default value is undef. * "no_css" No CSS support flag. If this flag is set to 1, process_css() returns undef. Default value is 0. * "tags" 'Tags::Output' object. Default value is undef. "cleanup" $obj->cleanup; Cleanup module to init state. Returns undef. "init" $obj->init($tree); Set Tree instance defined by $tree to object. Returns undef. "prepare" $obj->prepare; Process initialization before page run. Preparing is about adding javascript used in helper to "script_js" in Tags::HTML method. Returns undef. "process" $obj->process; Process Tags structure for output with message. Returns undef. "process_css" $obj->process_css; Process CSS::Struct structure for output. Returns undef. ERRORS new(): From Class::Utils::set_params(): Unknown parameter '%s'. From Tags::HTML::new(): Parameter 'tags' must be a 'Tags::Output::*' class. Parameter 'css_class' is required. init(): Data object must be a 'Tree' instance. process(): From Tags::HTML::process(): Parameter 'tags' isn't defined. EXAMPLE1 use strict; use warnings; use CSS::Struct::Output::Raw; use Tags::HTML::Tree; use Tags::HTML::Page::Begin; use Tags::HTML::Page::End; use Tags::Output::Raw; use Tree; use Unicode::UTF8 qw(decode_utf8 encode_utf8); my $css = CSS::Struct::Output::Raw->new; my $tags = Tags::Output::Raw->new( 'preserved' => ['style', 'script'], 'xml' => 1, ); my $tags_tree = Tags::HTML::Tree->new( 'css' => $css, 'tags' => $tags, ); $tags_tree->prepare; my $begin = Tags::HTML::Page::Begin->new( 'author' => decode_utf8('Michal Josef Špaček'), 'css' => $css, 'generator' => 'Tags::HTML::Tree', 'lang' => { 'title' => 'Tree', }, 'script_js' => $tags_tree->script_js, 'tags' => $tags, ); my $end = Tags::HTML::Page::End->new( 'tags' => $tags, ); # Example tree object. my $tree = Tree->new('Root'); $tree->meta({'uid' => 0}); my $count = 0; my %node; foreach my $node_string (qw/H I J K L M N O P Q/) { $node{$node_string} = Tree->new($node_string); $node{$node_string}->meta({'uid' => ++$count}); } $tree->add_child($node{'H'}); $node{'H'}->add_child($node{'I'}); $node{'I'}->add_child($node{'J'}); $node{'H'}->add_child($node{'K'}); $node{'H'}->add_child($node{'L'}); $tree->add_child($node{'M'}); $tree->add_child($node{'N'}); $node{'N'}->add_child($node{'O'}); $node{'O'}->add_child($node{'P'}); $node{'P'}->add_child($node{'Q'}); # Init. $tags_tree->init($tree); # Process CSS. $tags_tree->process_css; # Process HTML. $begin->process; $tags_tree->process; $end->process; # Print out. print encode_utf8($tags->flush); # Output: # # Tree EXAMPLE2 use strict; use warnings; use CSS::Struct::Output::Indent; use Tags::HTML::Tree; use Tags::HTML::Page::Begin; use Tags::HTML::Page::End; use Tags::Output::Indent; use Tree; use Unicode::UTF8 qw(decode_utf8 encode_utf8); my $css = CSS::Struct::Output::Indent->new; my $tags = Tags::Output::Indent->new( 'preserved' => ['style', 'script'], 'xml' => 1, ); my $tags_tree = Tags::HTML::Tree->new( 'css' => $css, 'tags' => $tags, ); $tags_tree->prepare; my $begin = Tags::HTML::Page::Begin->new( 'author' => decode_utf8('Michal Josef Špaček'), 'css' => $css, 'generator' => 'Tags::HTML::Tree', 'lang' => { 'title' => 'Tree', }, 'script_js' => $tags_tree->script_js, 'tags' => $tags, ); my $end = Tags::HTML::Page::End->new( 'tags' => $tags, ); # Example tree object. my $tree = Tree->new('Root'); $tree->meta({'uid' => 0}); my $count = 0; my %node; foreach my $node_string (qw/H I J K L M N O P Q/) { $node{$node_string} = Tree->new($node_string); $node{$node_string}->meta({'uid' => ++$count}); } $tree->add_child($node{'H'}); $node{'H'}->add_child($node{'I'}); $node{'I'}->add_child($node{'J'}); $node{'H'}->add_child($node{'K'}); $node{'H'}->add_child($node{'L'}); $tree->add_child($node{'M'}); $tree->add_child($node{'N'}); $node{'N'}->add_child($node{'O'}); $node{'O'}->add_child($node{'P'}); $node{'P'}->add_child($node{'Q'}); # Init. $tags_tree->init($tree); # Process CSS. $tags_tree->process_css; # Process HTML. $begin->process; $tags_tree->process; $end->process; # Print out. print encode_utf8($tags->flush); # Output: # # # # # # # # # Tree # # # # # # # DEPENDENCIES Class::Utils, English, Error::Pure, Mo::utils, Mo::utils::CSS, Scalar::Util, Unicode::UTF8, Tags::HTML. REPOSITORY AUTHOR Michal Josef Špaček LICENSE AND COPYRIGHT © 2024 Michal Josef Špaček BSD 2-Clause License VERSION 0.01