public function process(Parser $parser, $node, $variable, $data, array $options) { $environment = $parser->getEnvironment(); $kernel = $parser->getKernel(); $files = array(); foreach (explode("\n", $node->getValue()) as $file) { $file = trim($file); if ($file) { $environment->addDependency($file); $files[] = $file; } } $document = $parser->getDocument(); $document->addNode($kernel->build('Nodes\\TocNode', $files, $environment, $options)); }
public function process(Parser $parser, $node, $variable, $data, array $options) { if ($node) { $kernel = $parser->getKernel(); if ($node instanceof CodeNode) { $node->setLanguage(trim($data)); } if ($variable) { $environment = $parser->getEnvironment(); $environment->setVariable($variable, $node); } else { $document = $parser->getDocument(); $document->addNode($node); } } }