diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-10-08 13:38:36 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-10-08 13:38:36 -0500 |
commit | 52ea1ea3f9d1bd29dcb7b056536a8b3f58268dee (patch) | |
tree | 97ce9384137924d90170047c615438023fa09f18 /lib/Text | |
parent | 6d3b76546c92f15aadc2a9c4b7568411e49ccfbe (diff) | |
download | text-handlebars-52ea1ea3f9d1bd29dcb7b056536a8b3f58268dee.tar.gz text-handlebars-52ea1ea3f9d1bd29dcb7b056536a8b3f58268dee.zip |
implement hash args for normal helpers
Diffstat (limited to 'lib/Text')
-rw-r--r-- | lib/Text/Handlebars/Compiler.pm | 11 | ||||
-rw-r--r-- | lib/Text/Xslate/Syntax/Handlebars.pm | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/Text/Handlebars/Compiler.pm b/lib/Text/Handlebars/Compiler.pm index a358d2e..54f760d 100644 --- a/lib/Text/Handlebars/Compiler.pm +++ b/lib/Text/Handlebars/Compiler.pm @@ -103,8 +103,15 @@ sub _generate_call { line => $node->line, ); - push @{ $node->first->second }, $parser->call($make_hash, @hash); - $node->second(\@args); + my $hash = $parser->call($make_hash, @hash); + + if ($node->first->arity eq 'call' && $node->first->first->id eq '(make_block_helper)') { + push @{ $node->first->second }, $hash; + $node->second(\@args); + } + else { + $node->second([ @args, $hash ]); + } } return $self->SUPER::_generate_call($node); diff --git a/lib/Text/Xslate/Syntax/Handlebars.pm b/lib/Text/Xslate/Syntax/Handlebars.pm index 7d28824..0929f2c 100644 --- a/lib/Text/Xslate/Syntax/Handlebars.pm +++ b/lib/Text/Xslate/Syntax/Handlebars.pm @@ -309,6 +309,7 @@ sub nud_name { my $call = $self->call($name); if ($name->is_helper) { + $call->is_helper(1); push @{ $call->second }, $self->vars; } @@ -419,7 +420,6 @@ sub std_block { ? $block{else}{raw_text}->clone : $self->literal('')), ), - is_helper => 1, ); return $self->print_raw($name); } |