Adding a test that uses tabs.

Added a test for trailing tabs and -%}
Refs #284
This commit is contained in:
Mark Story
2011-03-22 22:59:56 -04:00
parent 22cf53fdfa
commit a615a3cc88
2 changed files with 14 additions and 2 deletions
+3 -1
View File
@@ -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]);
+11 -1
View File
@@ -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>