Module:WikidataIB/sandbox1: Difference between revisions

Content deleted Content added
apply precision to getCoords
clean up checkBlacklist
Line 983:
 
-------------------------------------------------------------------------------
-- checkBlacklist allows a test to check whether a named field is suppressedallowed
-- returns true if the field is not blacklisted (i.e. allowed)
-- returns false if the field is blacklisted (i.e. disallowed)
-- {{#if:{{#invoke:WikidataIB |checkBlacklist |name=Joe |suppressfields=Dave; Joe; Fred}} | not blacklisted | blacklisted}}
-- displays "blacklisted"
Line 990 ⟶ 992:
--
p.checkBlacklist = function(frame)
local blacklist = frame.args.suppressfields or ""
local fieldname = frame.args.name or ""
if blacklist ~= "" and fieldname ~= "" then
if blacklist:find(fieldname) then
return nil endfalse
else
return true
end
else
-- one of the fields is missing: let's call that "not on the list"
return true
end