From 012cf4e766bdf798a0f8e31ade1df8b3420f9e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Wed, 16 Oct 2024 21:06:18 +0200 Subject: [PATCH] fix: copy more than just rst files Now that we use literalinclude, source files include more than just rst files. I'd say anything with an extension goes. Files that are not rst files should be copied verbatim. This addresses an issue with guides not finding files referenced in literalinclude directives, because they were never copied. --- lib/Docs/RST/RSTCopier.php | 6 ++++++ lib/Docs/RST/RSTFileRepository.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Docs/RST/RSTCopier.php b/lib/Docs/RST/RSTCopier.php index 3a50e660..81a50a69 100644 --- a/lib/Docs/RST/RSTCopier.php +++ b/lib/Docs/RST/RSTCopier.php @@ -12,6 +12,7 @@ use function file_exists; use function is_string; use function preg_replace; +use function str_ends_with; use function str_replace; /** @final */ @@ -55,6 +56,11 @@ public function copyRst(Project $project, ProjectVersion $version): void continue; } + if (! str_ends_with($file, '.rst')) { + $this->filesystem->copy($file, $outputPath . str_replace($language->getPath(), '', $file)); + continue; + } + $this->copyFile( $project, $version, diff --git a/lib/Docs/RST/RSTFileRepository.php b/lib/Docs/RST/RSTFileRepository.php index 56926d3a..7a658719 100644 --- a/lib/Docs/RST/RSTFileRepository.php +++ b/lib/Docs/RST/RSTFileRepository.php @@ -58,7 +58,7 @@ public function getSourceFiles(string $path): array $finder = $this->getFilesFinder($path); - $finder->name('*.rst'); + $finder->name('*.*'); $finder->notName('toc.rst'); return $this->finderToArray($finder);