45,645
edits
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
local export = {} | local export = {} | ||
-- A helper function to escape magic characters in a string | -- A helper function to escape magic characters in a string | ||
-- Magic characters: ^$()%.[]*+-? | -- Magic characters: ^$()%.[]*+-? | ||
local plain = pattern_escape | local plain = require("Module:string").pattern_escape | ||
-- A helper function that removes empty numeric indexes in a table, | -- A helper function that removes empty numeric indexes in a table, | ||
Line 49: | Line 20: | ||
for name, param in pairs(params) do | for name, param in pairs(params) do | ||
if param.required then | if param.required then | ||
if param.alias_of then | |||
require("Module:debug").track("parameters/required alias") | |||
end | |||
required[name] = true | required[name] = true | ||
end | end | ||
Line 99: | Line 73: | ||
--Process required changes to `params` | --Process required changes to `params` | ||
for _, name in ipairs(names_with_equal_sign) do | for _, name in ipairs(names_with_equal_sign) do | ||
require("Module:debug").track("parameters/name with equals") | |||
params[string.gsub(name, "=", "")] = params[name] | params[string.gsub(name, "=", "")] = params[name] | ||
params[name] = nil | params[name] = nil | ||
Line 166: | Line 141: | ||
elseif param.type == "number" then | elseif param.type == "number" then | ||
val = tonumber(val) | val = tonumber(val) | ||
elseif param.type then | |||
require("Module:debug").track { | |||
"parameters/unrecognized type", | |||
"parameters/unrecognized type/" .. tostring(param.type) | |||
} | |||
end | end | ||