From 46eb33a8a3eb5a70396a49e12fe12c515f5ee513 Mon Sep 17 00:00:00 2001 From: Naoki Tomita Date: Thu, 11 Feb 2010 03:03:30 +0900 Subject: [PATCH] pod fix more --- lib/Template/Semantic.pm | 8 ++++---- lib/Template/Semantic/Cookbook.pod | 11 +++++++++++ lib/Template/Semantic/Document.pm | 10 ++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/lib/Template/Semantic.pm b/lib/Template/Semantic.pm index ead9c2d..413f799 100644 --- a/lib/Template/Semantic.pm +++ b/lib/Template/Semantic.pm @@ -20,7 +20,7 @@ sub new { $parser->$_($opt{$_}) for keys %opt; $parser; }; - + for (@Template::Semantic::Filter::EXPORT_OK) { $self->define_filter($_ => \&{'Template::Semantic::Filter::' . $_}); } @@ -272,8 +272,8 @@ I Replace the inner content with this as fragment XML/HTML. I Delete the element/attirbute that the selector indicates. $ts->process($template, { - 'h1' => undef, #

foo
=> - #
foo
+ 'h1' => undef, #

foo

bar
=> + #
bar
'div.foo@class' => undef, #
foo
=> #
foo
@@ -404,7 +404,7 @@ to delete, etc.). I Value and filters. Filters may be -A) Callback subroutine +A) Callback subroutine (code reference) B) Defined filter name diff --git a/lib/Template/Semantic/Cookbook.pod b/lib/Template/Semantic/Cookbook.pod index 1dc030e..754ae26 100644 --- a/lib/Template/Semantic/Cookbook.pod +++ b/lib/Template/Semantic/Cookbook.pod @@ -124,6 +124,7 @@ If template contains dummy items to check design, you may delete them first. { '.' => 'BBB' }, { '.' => 'CCC' }, { '.' => 'DDD' }, + { '.' => 'EEE' }, ], }); @@ -135,6 +136,16 @@ If template contains dummy items to check design, you may delete them first.
  • sample
  • +Output: + +
      +
    • AAA
    • +
    • BBB
    • +
    • CCC
    • +
    • DDD
    • +
    • EEE
    • +
    + =head2 Indicator only for Temlate::Semantic diff --git a/lib/Template/Semantic/Document.pm b/lib/Template/Semantic/Document.pm index 99ce955..3e9db50 100644 --- a/lib/Template/Semantic/Document.pm +++ b/lib/Template/Semantic/Document.pm @@ -39,7 +39,7 @@ sub as_string { my ($self, %opt) = @_; $opt{is_xhtml} = 1 unless defined $opt{is_xhtml}; - + if ($self->{source} =~ /^<\?xml/) { return $self->{dom}->serialize(1); } @@ -55,7 +55,7 @@ sub as_string { ); $self->{dom_hacked}++; } - + if (my $root = $self->{dom}->documentElement) { $r .= $root->serialize; $r =~ s/\n*$/\n/; @@ -160,7 +160,7 @@ sub _assign_value { my $joint; for my $v (@$value) { next if ref($v) ne 'HASH'; - + my $tmpl = $self->_to_node($node->serialize); $self->_query($tmpl, $v); $container->addChild($joint->cloneNode) if $joint; @@ -316,7 +316,9 @@ Template::Semantic::Document - Template::Semantic Result object =item $out = $out->process( \%vars ) Process again to the result and returns L -object again. So you can chain C<< ->process(...)->process(...) >>. +object again. So you can chain + + Template::Semantic->process(...)->process(...) =item "$out" (stringify)