From: Mark Story Date: Wed, 23 Mar 2011 02:59:56 +0000 (-0400) Subject: Adding a test that uses tabs. X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=a615a3cc88e5b6ae3bec29b8dfb781f3a3d36794;p=konrad%2Ftwig.git Adding a test that uses tabs. Added a test for trailing tabs and -%} Refs #284 --- diff --git a/lib/Twig/Lexer.php b/lib/Twig/Lexer.php index 6d66e87..ef8b33d 100644 --- a/lib/Twig/Lexer.php +++ b/lib/Twig/Lexer.php @@ -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]); diff --git a/test/Twig/Tests/Fixtures/tags/trim_block.test b/test/Twig/Tests/Fixtures/tags/trim_block.test index de26a2c..341a281 100644 --- a/test/Twig/Tests/Fixtures/tags/trim_block.test +++ b/test/Twig/Tests/Fixtures/tags/trim_block.test @@ -6,9 +6,19 @@ Whitespace trimming on tags.
  • {{ string }}
  • {%- endif %} + + --DATA-- -return array('string' => 'a value') +return array('string' => 'a value', 'trailing' => 'trailing tabs') --EXPECT-- + + \ No newline at end of file