Permalink
Browse files

Don't eat leading whitespace following a %-line

  • Loading branch information...
1 parent 0f73811 commit 3cce5767158a2f6dda4bd10e54541ad501bf2ff1 @flussence flussence committed Oct 26, 2012
Showing with 3 additions and 2 deletions.
  1. +1 −1 lib/Template/Mojo.pm
  2. +2 −1 t/00-basic.t
@@ -10,7 +10,7 @@ grammar Template::Mojo::Grammar {
}
token perlline {
- ^^ \h* '%' $<get-result>=['=']? $<expr>=[ <-[\n]>* ] \s+
+ ^^ \h* '%' $<get-result>=['=']? $<expr>=[ <-[\n]>* ] [\n | $]
}
token perlexpr {
View
@@ -1,6 +1,6 @@
use Test;
use Template::Mojo;
-plan 13;
+plan 14;
sub render($tmpl, *@a) {
Template::Mojo.new($tmpl).render(|@a)
@@ -20,3 +20,4 @@ is render("<a href='foo'>bar</a>"), "<a href='foo'>bar</a>";
is render("a happy <%= \$^a %>\n", 'bar'), "a happy bar\n";
is render("% my (\$a, \$b) = \@_\n<%= \$a %> and <%= \$b %>", 5, 7),
'5 and 7';
+is render("% 0\n an indented line\n%= 'foo'"), " an indented line\nfoo";

0 comments on commit 3cce576

Please sign in to comment.