diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-10-05 16:48:45 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-10-05 16:50:54 -0500 |
commit | 38805f6caa8155fecc3f24b74f1a89db1e2543cb (patch) | |
tree | 48dc3aa156b65b2fa5cda04483d9fa223a96659e /lib/Text | |
parent | dc22175fdfdc9a100cfc8e72efc6e6f7573835a1 (diff) | |
download | text-handlebars-38805f6caa8155fecc3f24b74f1a89db1e2543cb.tar.gz text-handlebars-38805f6caa8155fecc3f24b74f1a89db1e2543cb.zip |
hack to make normal helpers work for now
thinking about it some more, defining helpers separately from builtin
functions is a better idea, because helpers have to automatically
receive the context object, which makes them different from normal
functions. right now, i'm just special-casing mark_raw to avoid passing
the context object to it, but it needs to be more general than that
Diffstat (limited to 'lib/Text')
-rw-r--r-- | lib/Text/Xslate/Syntax/Handlebars.pm | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Text/Xslate/Syntax/Handlebars.pm b/lib/Text/Xslate/Syntax/Handlebars.pm index bf10ab5..495fd47 100644 --- a/lib/Text/Xslate/Syntax/Handlebars.pm +++ b/lib/Text/Xslate/Syntax/Handlebars.pm @@ -298,7 +298,17 @@ sub nud_name { my $name = $self->SUPER::nud_name($symbol); - return $self->call($name); + my $call = $self->call($name); + + use Data::Dump; ddx($self->token); + if ($self->token->is_defined) { + push @{ $call->second }, $self->expression(0); + } + elsif ($name->id ne 'mark_raw') { + push @{ $call->second }, $self->vars; + } + + return $call; } sub led_name { @@ -445,7 +455,6 @@ sub std_block { ($block{else} ? $block{else}{raw_text}->clone : $self->literal('')), - $self->vars, @{ $name->second }, ), ); |