diff options
Diffstat (limited to 'lib/Tree/Template/Declare/HTML_Element.pm')
-rw-r--r-- | lib/Tree/Template/Declare/HTML_Element.pm | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/Tree/Template/Declare/HTML_Element.pm b/lib/Tree/Template/Declare/HTML_Element.pm index 1480987..c2dd87c 100644 --- a/lib/Tree/Template/Declare/HTML_Element.pm +++ b/lib/Tree/Template/Declare/HTML_Element.pm @@ -10,6 +10,21 @@ sub new { return bless {},$class; } +sub _munge_exports { + my ($self,$exports)=@_; + + return { + %$exports, + text_node => sub($) { + $exports->{node}->( + sub { + $exports->{name}->('~text'); + $exports->{attribs}->(text => $_[0]); + }); + }, + }; +} + sub new_tree { my ($self)=@_; @@ -57,3 +72,36 @@ sub set_node_attributes { } 1; +__END__ + +=head1 NAME + +Tree::Template::Declare::HTML_Element + +=head1 SYNOPSIS + +See L<Tree::Template::Declare>. + +=head1 SPECIFICITIES + +This module will build trees using L<HTML::Element>. + +To create text nodes, you would be forced to say: + + node { + name '~text'; + attribs text => 'some text'; + } + +which is too cumbersone. You can instead use: + + text_node 'some text'; + +HTML::Element's C<deobjectify_text> method will be called by +C<finalize_tree> before returning the tree object. + +=head1 AUTHOR + +Gianni Ceccarelli <dakkar@thenautilus.net> + +=cut |