diff --git a/mkht.php b/mkht.php index 37020e7..68cdb1c 100755 --- a/mkht.php +++ b/mkht.php @@ -50,7 +50,6 @@ function clearnetOrOnion($clearnet_url, $onion_url) { } $dirs_last_update = []; -$dirs_entries = []; $pages_langs = []; $nodes = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(SITE, RecursiveDirectoryIterator::SKIP_DOTS)); @@ -80,6 +79,7 @@ foreach($nodes as $node) { $lang = $matches['lang'] ?? $config['default-lang'] ?? exit('no language found for ' . $src . LF); $pages_langs[$path_parts_src['dirname'] . '/' . $matches['pagename']][] = $lang; + $files_langs[$src] = $lang; $page_names[$src] = $matches['pagename']; } @@ -94,6 +94,7 @@ foreach ($pages as $node) { $base_filepath_target = $path_parts_target['dirname'] . '/' . $path_parts_target['filename']; $content = file_get_contents($src); + $lang = $files_langs[$src]; preg_match('/^# (?.*)$/Dm', $content, $matches); $title = $matches['title'] ?? NULL;