From c964148db9790676e892265327f567939619c349 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 28 Sep 2012 17:32:46 -0500 Subject: get blocks working --- lib/Text/Handlebars/Compiler.pm | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lib/Text/Handlebars/Compiler.pm (limited to 'lib/Text/Handlebars/Compiler.pm') 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; -- cgit v1.2.3-54-g00ecf