Modul:Wikidata utilities: Unterschied zwischen den Versionen

keine Bearbeitungszusammenfassung
KKeine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 2: Zeile 2:


function fw.checkId( id )
function fw.checkId( id )
local i = id and id:upper() or ''
if (not id) or (id == '') then return '' end
if i ~= '' then
local i = id:upper()
if mw.ustring.match( i, '^[%d]+$') ~= nil then -- only number
if mw.ustring.match( i, '^[%d]+$') ~= nil then -- only number
i = 'Q' .. i
i = 'Q' .. i
elseif mw.ustring.match( i, '^Q[%d]+$') == nil then -- Q and number
elseif mw.ustring.match( i, '^Q[%d]+$') == nil then -- Q and number
i = ''
i = ''
end
end
end
return i
return i
Anonymer Benutzer