diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-10-02 12:16:42 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-10-02 12:16:42 -0500 |
commit | 0722287d6c04831cdb40b64bae2ca55c24c2f555 (patch) | |
tree | 751d92348e4635bf845e1edc1df027fa32b3c4c2 /lib/Text/Handlebars | |
parent | 2986df9f1eef1112b2221a52bf0a025611ec4e09 (diff) | |
download | text-handlebars-0722287d6c04831cdb40b64bae2ca55c24c2f555.tar.gz text-handlebars-0722287d6c04831cdb40b64bae2ca55c24c2f555.zip |
handle inverted sections
Diffstat (limited to 'lib/Text/Handlebars')
-rw-r--r-- | lib/Text/Handlebars/Compiler.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Text/Handlebars/Compiler.pm b/lib/Text/Handlebars/Compiler.pm index 2150bba..5f112fc 100644 --- a/lib/Text/Handlebars/Compiler.pm +++ b/lib/Text/Handlebars/Compiler.pm @@ -11,10 +11,12 @@ sub _generate_block { my $self = shift; my ($node) = @_; - return ( - $self->_localize_vars($node->first), - (map { $self->compile_ast($_) } @{ $node->second }), - ); + my @compiled = map { $self->compile_ast($_) } @{ $node->second }; + + unshift @compiled, $self->_localize_vars($node->first) + if $node->first; + + return @compiled; } if (0) { |