mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 10:56:38 +00:00
Adding a test that uses tabs.
Added a test for trailing tabs and -%} Refs #284
This commit is contained in:
+3
-1
@@ -183,8 +183,10 @@ class Twig_Lexer implements Twig_LexerInterface
|
||||
|
||||
protected function lexBlock()
|
||||
{
|
||||
$trimTag = preg_quote($this->options['tag_trim_block'][1], '/');
|
||||
$endTag = preg_quote($this->options['tag_block'][1], '/');
|
||||
if (empty($this->brackets) && preg_match('/\s*'. $endTag.'/A', $this->code, $match, null, $this->cursor)) {
|
||||
|
||||
if (empty($this->brackets) && preg_match('/\s*'. $trimTag . '\h*|\s*' .$endTag.'/A', $this->code, $match, null, $this->cursor)) {
|
||||
|
||||
$this->pushToken(Twig_Token::BLOCK_END_TYPE);
|
||||
$this->moveCursor($match[0]);
|
||||
|
||||
@@ -6,9 +6,19 @@ Whitespace trimming on tags.
|
||||
<li>{{ string }}</li>
|
||||
{%- endif %}
|
||||
</ul>
|
||||
|
||||
<ul>
|
||||
{%- if trailing -%}
|
||||
<li>{{ trailing }}</li>
|
||||
{%- endif -%}
|
||||
</ul>
|
||||
--DATA--
|
||||
return array('string' => 'a value')
|
||||
return array('string' => 'a value', 'trailing' => 'trailing tabs')
|
||||
--EXPECT--
|
||||
<ul>
|
||||
<li>a value</li>
|
||||
</ul>
|
||||
|
||||
<ul>
|
||||
<li>trailing tabs</li>
|
||||
</ul>
|
||||
Reference in New Issue
Block a user