Skip to content

Commit 7be7dea

Browse files
committed
update rst parser
1 parent 348c776 commit 7be7dea

File tree

12 files changed

+22
-27
lines changed

12 files changed

+22
-27
lines changed

_build/composer.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

_build/src/HtmlKernel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ protected function createNodeFactory(): NodeFactoryInterface
104104
new NodeInstantiator(NodeTypes::TOC, SymfonyNodes\TocNode::class),
105105
new NodeInstantiator(NodeTypes::DOCUMENT, Document::class),
106106
new NodeInstantiator(NodeTypes::SEPARATOR, ParserNodes\SeparatorNode::class),
107-
new NodeInstantiator(NodeTypes::QUOTE, ParserNodes\QuoteNode::class)
107+
new NodeInstantiator(NodeTypes::QUOTE, ParserNodes\QuoteNode::class),
108+
new NodeInstantiator(NodeTypes::DEFINITION_LIST, ParserNodes\DefinitionListNode::class)
108109
);
109110
}
110111
}

_build/src/Nodes/AnchorNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class AnchorNode extends Base
88
{
9-
public function render(): string
9+
public function doRender(): string
1010
{
1111
return sprintf('<span id="%s"></span>', $this->value);
1212
}

_build/src/Nodes/CodeNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class CodeNode extends Base
5757
</div>
5858
TEMPLATE;
5959

60-
public function render(): string
60+
public function doRender(): string
6161
{
6262
$nodeValue = $this->getValue();
6363
assert(is_string($nodeValue));

_build/src/Nodes/ParagraphNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ParagraphNode extends Base
1010
{
1111
use ClassTrait;
1212

13-
public function render(): string
13+
public function doRender(): string
1414
{
1515
if ($this->value instanceof Node) {
1616
$text = trim($this->value->render());

_build/src/Nodes/TableNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class TableNode extends Base
99
{
10-
public function render(): string
10+
public function doRender(): string
1111
{
1212
$html = '<table class="docutils" border="1">';
1313

_build/src/Nodes/TitleNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class TitleNode extends Base
99
{
10-
public function render(): string
10+
public function doRender(): string
1111
{
1212
$anchor = Environment::slugify((string) $this->value);
1313

_build/src/Nodes/TocNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class TocNode extends Base
1111
/** @var int */
1212
private $depth;
1313

14-
public function render(): string
14+
public function doRender(): string
1515
{
1616
if (isset($this->options['hidden'])) {
1717
return '';

_build/tests/IntegrationTest.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use Doctrine\RST\Parser;
77
use Gajus\Dindent\Indenter;
88
use PHPUnit\Framework\TestCase;
9+
use Symfony\Component\Console\Helper\ProgressBar;
10+
use Symfony\Component\Console\Output\NullOutput;
911
use Symfony\Component\DomCrawler\Crawler;
1012
use Symfony\Component\Filesystem\Filesystem;
1113
use Symfony\Component\Finder\Finder;
@@ -46,8 +48,8 @@ public function testIntegration(string $folder)
4648
);
4749
}
4850

49-
$jsonGenerator = new JsonGenerator($builder->getDocuments());
50-
$jsonGenerator->generateJson(__DIR__.'/_output', __DIR__.'/_outputJson');
51+
$jsonGenerator = new JsonGenerator($builder->getDocuments()->getAll());
52+
$jsonGenerator->generateJson(__DIR__.'/_output', __DIR__.'/_outputJson', new ProgressBar(new NullOutput()));
5153

5254
foreach ($finder as $htmlFile) {
5355
$relativePath = $htmlFile->getRelativePathname();
@@ -236,17 +238,6 @@ public function parserUnitBlockProvider()
236238
];
237239
}
238240

239-
public function testRefReferenceError()
240-
{
241-
$this->expectException(\RuntimeException::class);
242-
243-
$this->createBuilder()->build(
244-
sprintf('%s/fixtures/source/ref-reference-error', __DIR__),
245-
__DIR__.'/_output',
246-
false // verbose
247-
);
248-
}
249-
250241
private function createBuilder(): Builder
251242
{
252243
$kernel = new HtmlKernel();

_build/tests/fixtures/expected/toctree/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset="utf-8" />
55
</head>
66
<body>
7+
<h1 id="toctree">Toctree<a class="headerlink" href="#toctree" title="Permalink to this headline"></a></h1>
78
<div class="toctree-wrapper compound">
89
<ul>
910
<li class="toctree-l1"><a class="reference internal" href="file.html">Title</a>
@@ -25,6 +26,7 @@
2526
</div>
2627
<div class="toctree-wrapper compound">
2728
<ul>
29+
<li class="toctree-l1"><a class="reference internal" href="index.html">Toctree</a></li>
2830
<li class="toctree-l1"><a class="reference internal" href="directory/another_file.html">Another file</a></li>
2931
<li class="toctree-l1"><a class="reference internal" href="file.html">Title</a>
3032
<ul>
@@ -40,6 +42,7 @@
4042
<li class="toctree-l2"><a class="reference internal" href="file.html#sub-title">Sub title</a></li>
4143
</ul>
4244
</li>
45+
<li class="toctree-l1"><a class="reference internal" href="index.html">Toctree</a></li>
4346
<li class="toctree-l1"><a class="reference internal" href="directory/another_file.html">Another file</a></li>
4447
</ul>
4548
</div>

_build/tests/fixtures/source/ref-reference-error/index.rst

Lines changed: 0 additions & 2 deletions
This file was deleted.

_build/tests/fixtures/source/toctree/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Toctree
2+
=======
13

24
.. toctree::
35

0 commit comments

Comments
 (0)