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]);
<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>
\ No newline at end of file