From ab64f8c31f63d5be9fb109fb062bb562064553b9 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 5 Oct 2012 13:14:14 -0500 Subject: actually, @foo just seems to be another kind of variable? really can't tell what the difference is between passing data in as normal template variables and passing them in as "template data" probably just won't support template data until someone can explain this better, because the handlebars test suite isn't very clear on the subject --- lib/Text/Handlebars.pm | 1 + lib/Text/Xslate/Syntax/Handlebars.pm | 21 +-------------------- 2 files changed, 2 insertions(+), 20 deletions(-) (limited to 'lib') diff --git a/lib/Text/Handlebars.pm b/lib/Text/Handlebars.pm index bbc53a9..7316ce8 100644 --- a/lib/Text/Handlebars.pm +++ b/lib/Text/Handlebars.pm @@ -46,6 +46,7 @@ sub default_functions { weaken(my $vars_copy = $vars); return { + '@index' => $i, %$vars, %$value, '..' => $vars_copy, diff --git a/lib/Text/Xslate/Syntax/Handlebars.pm b/lib/Text/Xslate/Syntax/Handlebars.pm index c08cee9..940d30d 100644 --- a/lib/Text/Xslate/Syntax/Handlebars.pm +++ b/lib/Text/Xslate/Syntax/Handlebars.pm @@ -20,7 +20,7 @@ my $OPERATOR_TOKEN = sprintf( join('|', map{ quotemeta } qw(..)) ); -sub _build_identity_pattern { qr/[A-Za-z_][A-Za-z0-9_?-]*/ } +sub _build_identity_pattern { qr/\@?[A-Za-z_][A-Za-z0-9_?-]*/ } sub _build_comment_pattern { qr/\![^;]*/ } sub _build_line_start { undef } @@ -575,25 +575,6 @@ sub std_partial { ); } -sub nud_iterator { - my $self = shift; - my ($symbol) = @_; - - my $token = $self->token; - if ($token->arity ne 'variable') { - $self->_unexpected('iterator variable', $token); - } - - $self->advance; - - if ($token->id eq 'index') { - return $self->iterator_index; - } - else { - $self->_error("Unknown iterator variable " . $token->id); - } -} - sub undefined_name { my $self = shift; my ($name) = @_; -- cgit v1.2.3-54-g00ecf