- Docs: Module:Yesno/doc (should use {{module}})
- Styles: Module:Yesno/style.css
- Templates that use this module:
All modules: book, chronology, kbd, module, photos, post, todo, wikidata link, yesno.
return function (val, default)
val = type(val) == 'string' and val:lower() or val
if val == nil then
return nil
elseif val == true
or val == 'yes'
or val == 'y'
or val == 'true'
or val == 't'
or val == 'on'
or val == mw.message.new( 'htmlform-yes' ):plain()
or tonumber(val) == 1
then
return true
elseif val == false
or val == 'no'
or val == 'n'
or val == 'false'
or val == 'f'
or val == 'off'
or val == mw.message.new( 'htmlform-no' ):plain()
or tonumber(val) == 0
then
return false
else
return default
end
end