Jump to content

Module:User:Benwing2/test-params

From Wiktionary, the free dictionary

This is a private module sandbox of Benwing2, for their own experimentation. Items in this module may be added and removed at Benwing2's discretion; do not rely on this module's stability.


local export = {}

function export.test(frame)
	local params = {
		["g"] = {list = true},
		[1] = {list = "h"},
		["sort"] = {type = "boolean"},
		["clq"] = {type = "boolean"},
		["partclq"] = {type = "boolean", list = "clq", allow_holes = true, require_index = true},
		["cal"] = {alias_of = "clq", type = "boolean"},
		["partcal"] = {alias_of = "partclq", list = "cal", type = "boolean", allow_holes = true, require_index = true},
		["calq"] = {alias_of = "clq", type = "boolean"},
		["partcalq"] = {alias_of = "partclq", list = "calq", type = "boolean"},
		["calque"] = {alias_of = "clq"},
		["partcalque"] = {alias_of = "partclq", list = true, allow_holes = true, require_index = true},
		["convert_plus_1"] = {type = "number", convert = function(val) return val + 1 end},
		["convert_concat_1"] = {convert = function(val) return val .. 1 end},
		["convert_error"] = {type = "number", convert = function(val, parse_err) parse_err("error in convert_error: " .. val) end},
		["bool_sublist"] = {type = "boolean", sublist = true},
		["qual_sublist"] = {type = "qualifier", sublist = true},
		["ref_sublist"] = {type = "references", sublist = "%$%$"},
		["comma_no_whitespace_sublist"] = {type = "references", sublist = require("Module:User:Benwing2/parameters").split_on_comma_without_whitespace},
		["num_slash_sublist"] = {type = "number", sublist = "/"},
		["convert_error_sublist"] = {type = "number", convert = function(val, parse_err) parse_err("error in convert_error_sublist: " .. val) end, sublist = "/"},
		["convert_plus_1_slash_sublist"] = {type = "number", convert = function(val) return val + 1 end, sublist = "/"},
		["convert_plus_1_slash_sublist_set"] = {type = "number", convert = function(val) return val + 1 end, sublist = "/", set = {1, 2, 3}},
		["q"] = {list = true, allow_holes = true, separate_no_index = true},
		["qalias"] = {list = true, allow_holes = true, alias_of = "q"},
		["qq"] = {list = true, allow_holes = true, separate_no_index = true},
		["qqalias"] = {list = true, allow_holes = true, alias_of = "qq", separate_no_index = false},
		["a"] = {list = true, type = "number", allow_holes = true, separate_no_index = true},
		["aalias"] = {list = true, allow_holes = true, alias_of = "a"},
		["booldefault"] = {type = "boolean", default = "true"},
		["booldefault2"] = {type = "boolean", default = true},
		["booldefault3"] = {type = "boolean", default = "false"},
		["booldefault4"] = {type = "boolean", default = false},
	}
	local args = require("Module:User:Benwing2/parameters").process(frame:getParent().args, params)
	return mw.dumpObject(args)
end

return export