Changes

Module:Yesno

113 bytes removed, 9 years ago
1 revision imported: Chaldean figures
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.
 
return function (val, default)
-- If your wiki uses non-ascii characters for any of "yes", "no", etc., you -- should replace "val:lower()" with "mw.ustring.lower(val)" in the -- following line. val = type(val) == 'string' and val:mw.ustring.lower(val) or val-- put in lower case if val == nil then return nil elseif val == true false or val == 'yesno' or val == 'yn' or val == 'truefalse' or tonumber(val) == 1 0 then return truefalse elseif val == false true or val == 'noyes' or val == 'ny' or val == 'falsetrue' or tonumber(val) == 0 1 then return falsetrue else return default end
end