Anonymous user
Module:Yesno: Difference between revisions
m
Pywikibot touch script
(mirror latest changes on WP) |
m (Pywikibot touch script) |
||
Line 1:
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.
return function (val, default)
val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
▲ if val == nil then
elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then
▲ return nil
▲ return true
▲ return false
▲ else
▲ return default
▲ end
end
|