removed the newline after a comment (closes #195)

This commit is contained in:
Fabien Potencier
2010-12-10 07:13:32 +01:00
parent 67452dbe73
commit 77bec04874
3 changed files with 9 additions and 4 deletions
+1
View File
@@ -8,6 +8,7 @@ Backward incompatibilities:
Changes:
* removed the newline after a comment (mimicks PHP behavior)
* added a syntax error exception when parent block is used on a template that does not extend another one
* made the Escaper and Optimizer extensions enabled by default
* fixed sandbox extension when used with auto output escaping
+8
View File
@@ -201,8 +201,16 @@ class Twig_Lexer implements Twig_LexerInterface
if (!preg_match('/(.*?)'.preg_quote($this->options['tag_comment'][1], '/').'/As', $this->code, $match, null, $this->cursor)) {
throw new Twig_Error_Syntax('unclosed comment', $this->lineno, $this->filename);
}
$this->moveCursor($match[0]);
$this->moveLineNo($match[0]);
// mimicks the behavior of PHP by removing the newline that follows instructions if present
if ("\n" === substr($this->code, $this->cursor, 1)) {
$this->moveCursor("\n");
$this->moveLineNo("\n");
}
break;
case $this->options['tag_block'][0]:
@@ -35,15 +35,11 @@ foo,bar
1,bar
0,foo
1,2
bar
bar
FOO,BAR,
1,2