Diferencies ente revisiones de «Módulu:WikidataCheck»

Contenido eliminado Contenido añadido
mSin resumen de edición
Oriciu (alderique | contribuciones)
Sin resumen de edición
Llinia 10:
local catbase = config.category
local namespaces = config.namespaces
local nocatsame = config.nocatsame or ""
local ok = false -- one-way flag to check if we're in a good namespace
local ns = mw.title.getCurrentTitle().namespace
Línea 25 ⟶ 24:
return "[[Categoría:Wikipedia:" .. catbase .. " non en Wikidata]]"
end
local claims = entity.claims or {}
if value == "" then
local hasProp = claims[property]
return nil -- Using Wikidata
if not hasProp then -- no claim of that property
end
return "[[Categoría:WikipediaCategory:" .. catbase .. " non en Wikidata]]" -- bad. Bot needs to add the property
local claims = entity.claims or {}
end
local hasProp = claims[property]
local propValue = hasProp[1].mainsnak.datavalue.value -- This should eventually iterate over all possible values?
if not hasProp then -- no claim of that property
if value == "" then
return "[[Categoría:Wikipedia:" .. catbase .. " non en Wikidata]]" -- bad. Bot needs to add the property
return nil -- Using Wikidata
end
if elseif propValue == value then
for i, v in ipairs(hasProp) do -- Now we try to iterate over all possible values?
return "[[Categoría:Wikipedia:" .. catbase .. " igual en Wikidata]]" -- yay!
propValue = (v.mainsnak.datavalue or {}).value
else
if propValue == value then
return "[[Categoría:Wikipedia:" .. catbase .. " diferente en Wikidata]]" -- needs human review :(
if nocatsame == "" then
end
return "[[Categoría:Wikipedia:" .. catbase .. " igual en Wikidata]]" -- yay!
else
return nil -- if nocatsame, the "same as" category is not added
end
end
end
return "[[Categoría:Wikipedia:" .. catbase .. " diferente en Wikidata]]" -- needs human review :(
end