Modul:Wikidata utilities: Unterschied zwischen den Versionen
Modul:Wikidata utilities (Quelltext anzeigen)
Version vom 31. Oktober 2017, 18:54 Uhr
, vor 6 Jahrenkeine Bearbeitungszusammenfassung
(angelegt) |
KKeine Bearbeitungszusammenfassung |
||
Zeile 1: | Zeile 1: | ||
local fw = {} | local fw = {} | ||
function fw.checkId( id ) | |||
local i = id and id:upper() or '' | |||
if i ~= '' then | |||
if mw.ustring.match( i, '^[%d]+$') ~= nil then -- only number | |||
i = 'Q' .. i | |||
elseif mw.ustring.match( i, '^Q[%d]+$') == nil then -- Q and number | |||
i = '' | |||
end | |||
end | |||
return i | |||
end | |||
local function getFirstValue( statements ) | local function getFirstValue( statements ) |