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

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;