mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 10:56:38 +00:00
removed the newline after a comment (closes #195)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user