Update website
This commit is contained in:
parent
4413528994
commit
1d90fbf296
6865 changed files with 1091082 additions and 0 deletions
53
vendor/doctrine/rst-parser/lib/Directives/Toctree.php
vendored
Normal file
53
vendor/doctrine/rst-parser/lib/Directives/Toctree.php
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\RST\Directives;
|
||||
|
||||
use Doctrine\RST\Nodes\Node;
|
||||
use Doctrine\RST\Parser;
|
||||
use Doctrine\RST\Toc\GlobSearcher;
|
||||
use Doctrine\RST\Toc\ToctreeBuilder;
|
||||
|
||||
final class Toctree extends Directive
|
||||
{
|
||||
/** @var ToctreeBuilder */
|
||||
private $toctreeBuilder;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->toctreeBuilder = new ToctreeBuilder(new GlobSearcher());
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return 'toctree';
|
||||
}
|
||||
|
||||
/** @param string[] $options */
|
||||
public function process(
|
||||
Parser $parser,
|
||||
?Node $node,
|
||||
string $variable,
|
||||
string $data,
|
||||
array $options
|
||||
): void {
|
||||
if ($node === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$environment = $parser->getEnvironment();
|
||||
|
||||
$toctreeFiles = $this->toctreeBuilder
|
||||
->buildToctreeFiles($environment, $node, $options);
|
||||
|
||||
foreach ($toctreeFiles as $file) {
|
||||
$environment->addDependency($file);
|
||||
}
|
||||
|
||||
$tocNode = $parser->getNodeFactory()
|
||||
->createTocNode($environment, $toctreeFiles, $options);
|
||||
|
||||
$parser->getDocument()->addNode($tocNode);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue