Update website

This commit is contained in:
Guilhem Lavaux 2024-11-19 08:02:04 +01:00
parent 4413528994
commit 1d90fbf296
6865 changed files with 1091082 additions and 0 deletions

View 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);
}
}