diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-10-24 18:00:21 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-01-02 13:56:21 -0600 |
commit | 6f0daf7d3c5fa3311cb6c11257cb671981eadc3a (patch) | |
tree | fd1fe1e740a39e368ddcde2c045c2b55e20b11d0 /lib | |
parent | 32ec4a2cda7b608c8da3575318347c140a89c2f9 (diff) | |
download | text-handlebars-6f0daf7d3c5fa3311cb6c11257cb671981eadc3a.tar.gz text-handlebars-6f0daf7d3c5fa3311cb6c11257cb671981eadc3a.zip |
gfx doesn't want to support a render_string opcode
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Text/Handlebars.pm | 4 | ||||
-rw-r--r-- | lib/Text/Handlebars/Compiler.pm | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/lib/Text/Handlebars.pm b/lib/Text/Handlebars.pm index 2bd0096..d4a3778 100644 --- a/lib/Text/Handlebars.pm +++ b/lib/Text/Handlebars.pm @@ -143,6 +143,10 @@ sub _register_builtin_methods { my ($funcs) = @_; weaken(my $weakself = $self); + $funcs->{'(render_string)'} = sub { + my ($to_render, $vars) = @_; + return $weakself->render_string($to_render, $vars); + }; $funcs->{'(make_block_helper)'} = sub { my ($code, $raw_text, $else_raw_text, $hash) = @_; diff --git a/lib/Text/Handlebars/Compiler.pm b/lib/Text/Handlebars/Compiler.pm index de7b0c4..5b99471 100644 --- a/lib/Text/Handlebars/Compiler.pm +++ b/lib/Text/Handlebars/Compiler.pm @@ -236,7 +236,7 @@ sub is_unary { my %unary = ( map { $_ => 1 } qw(builtin_is_array_ref builtin_is_hash_ref is_code_ref - find_file render_string) + find_file) ); return $unary{$id}; @@ -279,10 +279,12 @@ sub _generate_run_code { ); } - my $render_string = $self->parser->symbol('(render_string)')->clone( - id => 'render_string', - arity => 'unary', - first => $to_render, + # XXX turn this into an opcode + my $render_string = $self->call( + $node, + '(render_string)', + $to_render, + $self->vars, ); return $self->compile_ast($render_string); |