Skip to content

Commit

Permalink
fix: copy more than just rst files
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
greg0ire committed Oct 16, 2024
1 parent 51ffe23 commit 012cf4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/Docs/RST/RSTCopier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/Docs/RST/RSTFileRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 012cf4e

Please sign in to comment.