Jump to content

Module:Yesno

ຈາກ ວິກິພີເດຍ

Documentation for this module may be created atModule:Yesno/doc

-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.

returnfunction(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'andval:lower()orval
ifval==nilthen
returnnil
elseifval==true
orval=='yes'
orval=='y'
orval=='true'
orval=='t'
orval=='on'
orval=='ແມ່ນ'
orval=='ຈິງ'
orval=='ຖືກ'
ortonumber(val)==1
then
returntrue
elseifval==false
orval=='no'
orval=='n'
orval=='false'
orval=='f'
orval=='off'
orval=='ບໍ່'
orval=='ບໍ່ແມ່ນ'
orval=='ບໍ່ຈິງ'
orval=='ຜິດ'
ortonumber(val)==0
then
returnfalse
else
returndefault
end
end