Ignore uppercase-only filenames (like README.md)

This commit is contained in:
Miraty 2023-11-03 11:05:25 +01:00
parent 510da4d641
commit 5c31f0798e
1 changed files with 5 additions and 1 deletions

View File

@ -73,9 +73,13 @@ foreach($nodes as $node) {
copy($src, $target);
if ($node_info->getExtension() !== 'md')
continue;
$pages[] = $node;
preg_match('/(?<pagename>[-\w]+)(?:\.(?<lang>[a-z]{2}))?\.md/', $path_parts_src['basename'], $matches);
if ($matches['pagename'] === strtoupper($matches['pagename'])) // Ignore uppercase-only filenames (like README.md)
continue;
$pages[] = $node;
$lang = $matches['lang'] ?? $config['default-lang'] ?? exit('no language found for ' . $src . LF);
$pages_langs[$path_parts_src['dirname'] . '/' . $matches['pagename']][] = $lang;