모듈토론:Yesno
마지막 의견: 3년 전 (강승헌7님) - 주제: 2021년 7월 18일의 편집 요청
2021년 7월 18일의 편집 요청
편집이 편집 요청은 검토되었습니다. 요청을 재활성화하려면 |처리= 변수를 지워주세요. |
요청 내용은 다음과 같습니다:
-- 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 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 == '예'
or val == '참'
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 == '아니요'
or val == '거짓'
or tonumber(val) == 0
then
return false
else
return default
end
end
사유: false는 no와 비슷하고 no는 아니요가 맞는데 "아니요"라고 표기되어 있지 않기 때문입니다. --강승헌7 (토론) 2021년 7월 18일 (일) 16:21 (KST)