diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-09-28 17:32:46 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-09-28 17:32:46 -0500 |
commit | c964148db9790676e892265327f567939619c349 (patch) | |
tree | 8823cc12b17e18d1c17cd2f472a6933f0c89e607 /lib/Text/Handlebars/Compiler.pm | |
parent | 5d1c22c9436077c5e3dede4abe55dbc8713a1e4c (diff) | |
download | text-handlebars-c964148db9790676e892265327f567939619c349.tar.gz text-handlebars-c964148db9790676e892265327f567939619c349.zip |
get blocks working
Diffstat (limited to 'lib/Text/Handlebars/Compiler.pm')
-rw-r--r-- | lib/Text/Handlebars/Compiler.pm | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/Text/Handlebars/Compiler.pm b/lib/Text/Handlebars/Compiler.pm new file mode 100644 index 0000000..2150bba --- /dev/null +++ b/lib/Text/Handlebars/Compiler.pm @@ -0,0 +1,38 @@ +package Text::Handlebars::Compiler; +use Any::Moose; + +extends 'Text::Xslate::Compiler'; + +has '+syntax' => ( + default => 'Handlebars', +); + +sub _generate_block { + my $self = shift; + my ($node) = @_; + + return ( + $self->_localize_vars($node->first), + (map { $self->compile_ast($_) } @{ $node->second }), + ); +} + +if (0) { + our $_recursing; + around compile_ast => sub { + my $orig = shift; + my $self = shift; + + my @ast = do { + local $_recursing = 1; + $self->$orig(@_); + }; + use Data::Dump; ddx(\@ast) unless $_recursing; + return @ast; + }; +} + +__PACKAGE__->meta->make_immutable; +no Any::Moose; + +1; |