Module:Yesno: திருத்தங்களுக்கு இடையிலான வேறுபாடு

உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
change to a simpler Lua-only version
imported>Thiagalingam
சி 35 திருத்தங்கள் இறக்குமதி செய்யப்பட்டன: Thiagalingam
 
(12 பயனர்களால் செய்யப்பட்ட 21 இடைப்பட்ட திருத்தங்கள் காட்டப்படவில்லை.)
வரிசை 1:
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- This is a simplified, Lua-only replacement for the template {{yesno}}. It provides a consistent
-- It works similarly to the template {{yesno}}.
-- interface for users entering boolean or boolean-style input.
 
return function (val, default)
-- If your wiki uses non-ascii characters for any of "yes", "no", etc., you
val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
-- should replace "val:lower()" with "mw.ustring.lower(val)" in the
if not val or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then
-- following line.
return false
elseif val == true or type(val) == 'yesstring' orand val == 'y':lower() or val == 'true' or tonumber(val) == 1 then
if val == nil then
return true
return nil
elseif default ~= nil then
elseif val == true
return default
or val == 'yes'
else
or val == 'y'
return true
or val == 'true'
end
or val == 't'
or val == 'on'
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 tonumber(val) == 0
then
return false
else
return default
end
end
"https://tamilar.wiki/w/Module:Yesno" இலிருந்து மீள்விக்கப்பட்டது