local p =
--
local types_of_country =
local isCountry = for i, v in ipairs(types_of_country) do isCountry[v] = trueend
--------------------------------------------------------------------------------- _iscountry takes Q-id and returns true if it's a country.--------------------------------------------------------------------------------- Dependencies:-------------------------------------------------------------------------------p._iscountry = function(qid) local inst = mw.wikibase.getBestStatements(qid, "P31") if #inst > 0 then for i, v in ipairs(inst) do local instid = v.mainsnak.datavalue and v.mainsnak.datavalue.value.id if isCountry[instid] then return true end end end return falseend
p.iscountry = function(frame) local args = frame.args if not args.qid then args = frame:getParent.args end return p._iscountry(args.qid) or "" -- return empty string not "false" to invokeend
return p