4 * This file is part of Twig.
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
13 * Remove whitespaces between HTML tags.
18 * <strong>foo</strong>
22 * {# output will be <div><strong>foo</strong></div> #}
27 class Twig_TokenParser_Spaceless extends Twig_TokenParser
29 public function parse(Twig_Token $token)
31 $lineno = $token->getLine();
33 $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
34 $body = $this->parser->subparse(array($this, 'decideSpacelessEnd'), true);
35 $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
37 return new Twig_Node_Spaceless($body, $lineno, $this->getTag());
40 public function decideSpacelessEnd(Twig_Token $token)
42 return $token->test('endspaceless');
45 public function getTag()
51 class_alias('Twig_TokenParser_Spaceless', 'Twig\TokenParser\SpacelessTokenParser', false);