X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FHTML%2FElement%2FLibrary.pod;h=909aa9ecefccf2f15a86ed00ae6cfa57a7b86120;hb=271d5078dc10f92db0d9927bd84065a0b9a38397;hp=c7cde764c2da5f3504d1b0e54570382bd6167287;hpb=d161c455bd0d5835fca07d91ac428da07f47136b;p=html-element-library.git diff --git a/lib/HTML/Element/Library.pod b/lib/HTML/Element/Library.pod index c7cde76..909aa9e 100644 --- a/lib/HTML/Element/Library.pod +++ b/lib/HTML/Element/Library.pod @@ -1089,27 +1089,89 @@ to display: +=head2 Tree-Killing Methods +=head3 $tree->prune -=head1 SEE ALSO +This removes any nodes from the tree which consist of nothing or nothing but whitespace. +See also delete_ignorable_whitespace in L. -=over +=head2 Loltree Functions + +A loltree is an arrayref consisting of arrayrefs which is used by +C<< new_from__lol >> in L to produce HTML trees. +The CPAN distro L creates such XML trees by parsing XML files, +analagous to L. The purpose of the functions in this section is to allow +you manipulate a loltree programmatically. -=item * L +These could not be methods because if you bless a loltree, then HTML::Tree will barf. -A perl package for creating and manipulating HTML trees +=head3 HTML::Element::replace_node($lol, $node_label, $new_node) -=item * L +Given this initial loltree: + + my $initial_lol = [ note => [ shopping => [ item => 'sample' ] ] ]; + +This code: + + sub shopping_items { + my @shopping_items = map { [ item => _ ] } qw(bread butter beans) ; + \@shopping_items; + } + + my $new_lol = HTML::Element::newnode($initial_lol, item => shopping_items()); + + will replace the single sample with a list of shopping items: + + + [ + 'note', + [ + 'shopping', + [ + [ + 'item', + 'bread' + ], + [ + 'item', + 'butter' + ], + [ + 'item', + 'beans' + ] + ] + ] + ]; + +Thanks to kcott and the other Perlmonks in this thread: +http://www.perlmonks.org/?node_id=912416 + + +=head1 SEE ALSO + +=head2 L + +A perl package for creating and manipulating HTML trees. + +=head2 L An L - based module which allows for manipulation of HTML trees using cartesian coordinations. -=item * L +=head2 * L An L - based module inspired by XMLC (L), allowing for dynamic HTML generation via tree rewriting. +=head2 Push-style tmeplating systems + +A comprehensive cross-language +L. + + =head1 TODO =over