local p = -- Function allowing for consistent treatment of boolean-like wikitext input.-- It works similarly to the template {{yesno}}.
return function p.yesno(frameval, default) --If your wiki uses non- defaults local retvals = { yes = ascii characters for any of "yes", "no = "",etc., you [ -- should replace "¬val:lower()"] = with "mw.ustring.lower(val)"in the } -- Allow arguments to override defaultsfollowing line. -- 'any' tracks the presence of any arguments at all. local args = frame.args local any val = false for k,v in pairstype(argsval) do any = true retvals[k] = v end -- If there are no arguments, try 'string' and get them from the parent frame. if any == false then local pframe = frameval:getParentlower()or val args if val = pframe.args for k,v in pairs(args) do retvals[k] = vnil then end return nil end elseif val = args[1]= true -- First deal with the case if val is nil or "¬", then deal with other cases. if val == nil 'yes' or val == '¬y' then return retvals[ or val == '¬true'] end or val = val:lower() -- Make lowercase. val = val:match'^%s*(.*%S)t' or val == 'on' -- Trim whitespace. if or tonumber(val ) == '' 1 then return retvals['blank'] or retvals['no']true elseif val == 'n' false or val == 'no' or val == '0n' then return retvals['no'] elseif or val == 'yfalse' or val == 'yesf' or val == '1off' or retvals['def'] tonumber(val) == nil 0 then return retvals['yes']false else return retvals['def']default end
end
return p