Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add internlink index rendering #633

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/Docs/RST/DocumentsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

namespace Doctrine\Website\Docs\RST;

use Doctrine\Website\Model\ProjectVersion;
use phpDocumentor\Guides\Nodes\DocumentNode;

interface DocumentsBuilder
{
public function build(string $directory, string $targetDirectory = 'output'): void;
public function build(ProjectVersion $version, string $directory, string $targetDirectory = 'output'): void;

/** @return DocumentNode[] */
public function getDocuments(): array;
Expand Down
15 changes: 13 additions & 2 deletions lib/Docs/RST/Guides.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Doctrine\Website\Docs\RST;

use Doctrine\Website\Model\ProjectVersion;
use Flyfinder\Finder;
use League\Flysystem\Adapter\Local;
use League\Flysystem\Filesystem;
Expand All @@ -25,12 +26,12 @@ public function __construct(
}

#[Override]
public function build(string $directory, string $targetDirectory = 'output'): void
public function build(ProjectVersion $version, string $directory, string $targetDirectory = 'output'): void
{
$sourceFileSystem = new Filesystem(new Local($directory));
$sourceFileSystem->addPlugin(new Finder());

$projectNode = new ProjectNode();
$projectNode = new ProjectNode($version->getProject()->getName(), $version->getName());
$this->documents = $this->guidesParser->parse($directory, $projectNode);

$destinationFileSystem = new Filesystem(new Local($targetDirectory));
Expand All @@ -44,6 +45,16 @@ public function build(string $directory, string $targetDirectory = 'output'): vo
$projectNode,
),
);

$this->commandBus->handle(
new RenderCommand(
'interlink',
$this->documents,
$sourceFileSystem,
$destinationFileSystem,
$projectNode,
),
);
}

/** @return DocumentNode[] */
Expand Down
1 change: 1 addition & 0 deletions lib/Docs/RST/RSTBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ private function buildRst(Project $project, ProjectVersion $version, RSTLanguage
$this->filesystem->remove($this->rstFileRepository->findFiles($outputPath));

$this->builder->build(
$version,
$project->getProjectVersionDocsPath($this->docsDir, $version, $language->getCode()),
$outputPath,
);
Expand Down
Loading