en:Module:Check for unknown parameters 16:30, 12 January 2016(UTC)より
template>K-iczn (en:Module:Check for unknown parameters 17:31, 21 December 2015(UTC)より) |
template>K-iczn (en:Module:Check for unknown parameters 16:30, 12 January 2016(UTC)より) |
||
18行目: | 18行目: | ||
local checkpos = isnotempty(frame.args['checkpositional']) | local checkpos = isnotempty(frame.args['checkpositional']) | ||
local knownargs = {} | local knownargs = {} | ||
local unknown = 'Found _VALUE_, ' | local unknown = frame.args['unknown'] or 'Found _VALUE_, ' | ||
local preview = | local preview = frame.args['preview'] or unknown | ||
local res = {} | local res = {} | ||
33行目: | 33行目: | ||
v = trim(v) | v = trim(v) | ||
knownargs[v] = 1 | knownargs[v] = 1 | ||
elseif k:find('^regexp[1-9][0-9]*$') then | elseif k:find('^regexp[1-9][0-9]*$') then | ||
table.insert(regexps, '^' .. v .. '$') | table.insert(regexps, '^' .. v .. '$') | ||
end | end | ||
end | end | ||
if preview | if isnotempty(frame.args['preview']) then | ||
if ispreview == 1 | preview = '<div class="hatnote" style="color:red"><strong>Warning:</strong> ' .. frame.args['preview'] .. ' (this message is shown only in preview).</div>' | ||
elseif frame.args['preview'] then | |||
preview = frame.args['preview'] | |||
else | |||
preview = unknown | |||
end | |||
if ispreview == 1 then unknown = preview end | |||
-- adds one result to the output tables | -- adds one result to the output tables |