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,47 @@
<?php
declare(strict_types=1);
namespace Doctrine\Tests\RST\LiteralNestedInDirective;
use Doctrine\RST\Builder;
use Doctrine\RST\Configuration;
use Doctrine\RST\Kernel;
use Doctrine\Tests\RST\BaseBuilderTest;
use function shell_exec;
/**
* Unit testing for RST
*/
class BuilderTest extends BaseBuilderTest
{
protected function setUp(): void
{
shell_exec('rm -rf ' . $this->targetFile());
$kernel = new Kernel(
new Configuration(),
[new TipDirective()]
);
$this->builder = new Builder($kernel);
$this->builder->getConfiguration()->setUseCachedMetas(false);
$this->builder->build($this->sourceFile(), $this->targetFile());
}
public function testLiteralNestedInDirective(): void
{
$contents = $this->getFileContents($this->targetFile('index.html'));
self::assertStringContainsString('class="tip"', $contents);
self::assertStringContainsString('<code', $contents);
self::assertStringContainsString('</code>', $contents);
}
protected function getFixturesDirectory(): string
{
return 'LiteralNestedInDirective';
}
}

View file

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace Doctrine\Tests\RST\LiteralNestedInDirective;
use Doctrine\RST\Directives\SubDirective;
use Doctrine\RST\Nodes\Node;
use Doctrine\RST\Parser;
class TipDirective extends SubDirective
{
/** @param string[] $options */
final public function processSub(Parser $parser, ?Node $document, string $variable, string $data, array $options): ?Node
{
return $parser->getNodeFactory()->createWrapperNode($document, '<div class="tip">', '</div>');
}
/**
* Get the directive name
*/
public function getName(): string
{
return 'tip';
}
}

View file

@ -0,0 +1,9 @@
.. tip::
here is a tip with literal::
      use Composer\Autoload\ClassLoader;
/** @var ClassLoader $loader */
$loader = require __DIR__.'/../vendor/autoload.php';