You are here

public function TokenParser::parse in Markdown 8.2

File

src/Twig/TokenParser.php, line 30

Class

TokenParser
Twig Markdown Token Parser.

Namespace

Drupal\markdown\Twig

Code

public function parse(Token $token) {
  $tag = $this
    ->getTag();
  $line = $token
    ->getLine();
  $this->parser
    ->getStream()
    ->expect(\Twig_Token::BLOCK_END_TYPE);
  $body = $this->parser
    ->subparse(function (\Twig_Token $token) use ($tag) {
    return $token
      ->test("end{$tag}");
  }, TRUE);
  $this->parser
    ->getStream()
    ->expect(\Twig_Token::BLOCK_END_TYPE);
  return new Node($body, $line, $tag);
}