Modul:SDcat: Unterschied zwischen den Versionen

K
11 Versionen von wpen:Module:SDcat importiert
(Fix Lua error when Wikidata is unavailable (default to "different from Wikidata"))
K (11 Versionen von wpen:Module:SDcat importiert)
 
(2 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 22: Zeile 22:
-- (local short description, Wikidata entity-ID, link prefix)
-- (local short description, Wikidata entity-ID, link prefix)
p._setCat = function(sdesc, itemID, lp)
p._setCat = function(sdesc, itemID, lp)
if not mw.wikibase then return nil end
if itemID == "" then itemID = nil end
if itemID == "" then itemID = nil end
-- Wikidata description field
if not mw.wikibase == nil then
local wdesc = (mw.wikibase.getDescription(itemID) or ""):lower()
-- Wikidata description field
if wdesc == "" then
local wdesc = (mw.wikibase.getDescription(itemID) or ""):lower()
return "[[" .. lp .. "Category:Short description with empty Wikidata description]]"
if wdesc == "" then
elseif wdesc == sdesc then
return "[[" .. lp .. "Category:Short description with empty Wikidata description]]"
return "[[" .. lp .. "Category:Short description matches Wikidata]]"
elseif wdesc == sdesc then
else
return "[[" .. lp .. "Category:Short description matches Wikidata]]"
return "[[" .. lp .. "Category:Short description is different from Wikidata]]"
end
end
end
return "[[" .. lp .. "Category:Short description is different from Wikidata]]"
end
end