class TokenParser in Markdown 3.0.x
Class MarkdownTokenParser.
Hierarchy
- class \Drupal\markdown\Twig\Markdown\TokenParser extends \Drupal\markdown\Twig\Markdown\Twig_TokenParser
Expanded class hierarchy of TokenParser
File
- src/
Twig/ Markdown/ TokenParser.php, line 11
Namespace
Drupal\markdown\Twig\MarkdownView source
class TokenParser extends \Twig_TokenParser {
/**
* An instance of a markdown processor to use.
*
* @var \Drupal\markdown\MarkdownInterface
*/
protected $markdown;
/**
* {@inheritdoc}
*/
public function __construct(MarkdownInterface $markdown) {
$this->markdown = $markdown;
}
/**
* {@inheritdoc}
*/
public function parse(Token $token) {
$line = $token
->getLine();
$this->parser
->getStream()
->expect(\Twig_Token::BLOCK_END_TYPE);
$body = $this->parser
->subparse(function (\Twig_Token $token) {
return $token
->test('endmarkdown');
}, TRUE);
$this->parser
->getStream()
->expect(\Twig_Token::BLOCK_END_TYPE);
return new Node($body, $line, $this
->getTag());
}
/**
* {@inheritdoc}
*/
public function getTag() {
return 'markdown';
}
/**
* Return the markdown instance being used.
*
* @return \Drupal\markdown\MarkdownInterface
* The Markdown instance.
*/
public function getMarkdown() {
return $this->markdown;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TokenParser:: |
protected | property | An instance of a markdown processor to use. | |
TokenParser:: |
public | function | Return the markdown instance being used. | |
TokenParser:: |
public | function | ||
TokenParser:: |
public | function | ||
TokenParser:: |
public | function |