-- 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 mw.ustring.val:lower(val) or val -- put in lower case if val == nil then return nil elseif val == false true or val == 'noyes' or val == 'ny' or val == 'falsetrue' or tonumber(val) == 0 1 then return falsetrue elseif val == true false or val == 'yesno' or val == 'yn' or val == 'truefalse' or tonumber(val) == 1 0 then return truefalse else return default end
end