Add bootstrapping for tests, parse additional wikidata ID format

This commit is contained in:
jrenslin committed 2025-02-14 10:32:25 +01:00
1 parent 9d139f9154
commit 12689d24fa
4 files changed
+57

No files matched your search

+7
View File
@@ -624,6 +624,13 @@ private static function validateWikidataId(string $id):string|false {
'https://www.wikidata.org/entity/' => '',
'https://www.wikidata.org/w/index.php?search=&search=' => '',
]);
if (str_starts_with($id, 'https://www.wikidata.org/w/index.php?title=')) {
$id = str_replace('https://www.wikidata.org/w/index.php?title=', '', $id);
if (($endPos = strpos($id, '&')) !== false) {
$id = substr($id, 0, $endPos);
}
}
}
if (substr($id, 0, 1) !== 'Q') {