Skip to content

Commit d35a62e

Browse files
committed
Fixes from feedback
1 parent f518593 commit d35a62e

File tree

4 files changed

+8
-20
lines changed

4 files changed

+8
-20
lines changed

src/BuildResult.php

+5-9
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515

1616
class BuildResult
1717
{
18-
private $errors;
1918
private $builder;
19+
private $errors;
2020
private $jsonResults = [];
2121

22-
public function __construct(array $errors, Builder $builder)
22+
public function __construct(Builder $builder)
2323
{
24-
$this->errors = $errors;
2524
$this->builder = $builder;
25+
$this->errors = $builder->getErrorManager()->getErrors();
2626
}
2727

2828
public function appendError(string $errorMessage): void
@@ -45,7 +45,7 @@ public function getErrors(): array
4545
return $this->errors;
4646
}
4747

48-
public function getMetas(): Metas
48+
public function getMetadata(): Metas
4949
{
5050
return $this->builder->getMetas();
5151
}
@@ -54,18 +54,14 @@ public function getMetas(): Metas
5454
* Returns the "master document": the first file whose toctree is parsed.
5555
*
5656
* Unless customized, this is "index" (i.e. file index.rst).
57-
*
58-
* @return string
5957
*/
6058
public function getMasterDocumentFilename(): string
6159
{
6260
return $this->builder->getIndexName();
6361
}
6462

6563
/**
66-
* Returns the JSON data generated for each file, keyed by the source filename.
67-
*
68-
* @return array[]
64+
* Returns the JSON array data generated for each file, keyed by the source filename.
6965
*/
7066
public function getJsonResults(): array
7167
{

src/DocBuilder.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ public function build(BuildConfig $config): BuildResult
2525
$builder = new Builder(KernelFactory::createKernel($config));
2626
$builder->build($config->getContentDir(), $config->getOutputDir());
2727

28-
$buildResult = new BuildResult(
29-
$builder->getErrorManager()->getErrors(),
30-
$builder
31-
);
28+
$buildResult = new BuildResult($builder);
3229

3330
$missingFilesChecker = new MissingFilesChecker($config);
3431
$missingFiles = $missingFilesChecker->getMissingFiles();
@@ -41,7 +38,7 @@ public function build(BuildConfig $config): BuildResult
4138
$filesystem->dumpFile($config->getOutputDir().'/build_errors.txt', implode("\n", $buildResult->getErrors()));
4239
}
4340

44-
$metas = $buildResult->getMetas();
41+
$metas = $buildResult->getMetadata();
4542
if ($config->getSubdirectoryToBuild()) {
4643
$htmlForPdfGenerator = new HtmlForPdfGenerator($metas, $config);
4744
$htmlForPdfGenerator->generateHtmlForPdf();

src/Generator/JsonGenerator.php

-5
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,6 @@ public function generateJson(string $masterDocument = 'index'): array
7676
'toc' => $this->generateToc($metaEntry, current($metaEntry->getTitles())[1]),
7777
'next' => $next,
7878
'prev' => $prev,
79-
'rellinks' => [
80-
// probably these shouldn't be straight copies of next/prev
81-
$next,
82-
$prev,
83-
],
8479
'body' => $crawler->filter('body')->html(),
8580
];
8681

tests/fixtures/source/json/fields.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Fields
22
======
33

4-
I love fields: big open prairies, grass fields, corn fields... reall,
4+
I love fields: big open prairies, grass fields, corn fields... really,
55
any type of field, I'm a fan.

0 commit comments

Comments
 (0)