Content-Length: 89797 | pFad | https://zh.wiktionary.org/wiki/Module:Yesno

模組:Yesno - 维基词典,自由的多语言词典 跳转到内容

模組:Yesno

維基詞典,自由的多語言詞典


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

local booleans = {
	[true] = true, [false] = false,
	["true"] = true, ["false"] = false,
	[1] = true, [0] = false,
	["1"] = true, ["0"] = false,
	["yes"] = true, ["no"] = false,
	["y"] = true, ["n"] = false,
	["t"] = true, ["f"] = false,
	["on"] = true, ["off"] = false,
	["是"] = true, ["否"] = false,
}

return function (val, default)
	if val == nil then
		return nil
	elseif type(val) == "string" then
		val = lower(val)
	end
	if booleans[val] ~= nil then
		return booleans[val]
	end
	return default
end








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://zh.wiktionary.org/wiki/Module:Yesno

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy