Modul:IsCategory: razlika između inačica
Izvor: abcDNK
No edit summary |
No edit summary |
||
| Redak 11: | Redak 11: | ||
if entity_id ~= nil and mw.wikibase.isValidEntityId(entity_id) and mw.wikibase.entityExists(entity_id) then | if entity_id ~= nil and mw.wikibase.isValidEntityId(entity_id) and mw.wikibase.entityExists(entity_id) then | ||
entity = mw.wikibase.getEntity(entity_id) | entity = mw.wikibase.getEntity(entity_id) | ||
if entity["claims"]["P1"] ~= nil and 1 == 1 then | if entity ~= nil and entity["claims"] ~= nil and entity["claims"]["P1"] ~= nil and 1 == 1 then | ||
category = entity["claims"]["P1"][1]["mainsnak"]["datavalue"]["value"]["id"] | category = entity["claims"]["P1"][1]["mainsnak"]["datavalue"]["value"]["id"] | ||
end | end | ||
Posljednja izmjena od 14. veljače 2024. u 11:12
Documentation for this module may be created at Modul:IsCategory/doc
local p = {} --p stands for package
function p.is(frame)
ret = "display: none;"
entity_id = nil
if frame.args.title ~= nil and frame.args.title ~= "" then
entity_id = mw.wikibase.getEntityIdForTitle(frame.args.title)
elseif frame.args.id ~= nil and frame.args.id ~= "" then
entity_id = frame.args.id
end
if entity_id ~= nil and mw.wikibase.isValidEntityId(entity_id) and mw.wikibase.entityExists(entity_id) then
entity = mw.wikibase.getEntity(entity_id)
if entity ~= nil and entity["claims"] ~= nil and entity["claims"]["P1"] ~= nil and 1 == 1 then
category = entity["claims"]["P1"][1]["mainsnak"]["datavalue"]["value"]["id"]
end
if category == frame.args.category then
ret = ""
end
end
return ret
end
return p