Difference between revisions of "Module:Flag/sandbox"
Jump to navigation
Jump to search
blackwiki>Ahecht (uncb) |
blackwiki>Ahecht (sync) |
||
| Line 17: | Line 17: | ||
if check then | if check then | ||
local opts = { | local opts = { | ||
| − | unknown=' | + | unknown=frame:expandTemplate{ title = 'main other', args = { '[[Category:Pages using ' .. mw.ustring.lower(name) .. ' template with unknown parameters|_VALUE_' .. frame:getParent():getTitle() .. ']]' } }, |
preview='Page using [[Template:' .. name .. ']] with unknown parameter "_VALUE_"', | preview='Page using [[Template:' .. name .. ']] with unknown parameter "_VALUE_"', | ||
ignoreblank='y', | ignoreblank='y', | ||
[1] = '1', | [1] = '1', | ||
[2] = '2', | [2] = '2', | ||
| − | [3] = ' | + | [3] = 'variant', |
| − | [4] = 'size', | + | [4] = 'image', |
| − | [ | + | [5] = 'size', |
| + | [6] = 'sz', | ||
| + | [7] = 'border', | ||
| + | [8] = 'align', | ||
| + | [9] = 'al', | ||
| + | [10]= 'width', | ||
| + | [11]= 'w', | ||
| + | [12]= 'alt', | ||
| + | [13]= 'ilink', | ||
| + | [14]= 'noredlink', | ||
| + | [15]= 'missingcategory', | ||
| + | [16]= 'name', | ||
| + | [17]= 'clink', | ||
| + | [18]= 'link', | ||
| + | [19]= 'pref', | ||
| + | [20]= 'suff', | ||
| + | [21]= 'plink', | ||
| + | [22]= 'the', | ||
| + | [23]= 'section', | ||
| + | [24]= 'altvar', | ||
| + | [25]= 'avar', | ||
| + | [26]= 'age', | ||
| + | [27]= 'nalign', | ||
| + | [28]= 'nal', | ||
| + | [29]= 'text', | ||
| + | [30]= 'nodata', | ||
| + | [31]= 'opts' | ||
} | } | ||
| Line 34: | Line 60: | ||
args['variant'] = args[2] or args['variant'] | args['variant'] = args[2] or args['variant'] | ||
args[2] = args[1] | args[2] = args[1] | ||
| − | args[1] = mode | + | args[1] = mode .. (args['opts'] and args['opts'] or '') |
args['missingcategory'] = '[[Category:' .. name .. 'with missing country data templates]]' | args['missingcategory'] = '[[Category:' .. name .. 'with missing country data templates]]' | ||
args['noredlink'] = args['noredlink'] or 'no' | args['noredlink'] = args['noredlink'] or 'no' | ||
| Line 45: | Line 71: | ||
end | end | ||
| − | function p.main(frame) return p._main(frame, 'Flag', 'uncb', | + | function p.main(frame) return p._main(frame, 'Flag', 'uncb', false) end |
function p.deco(frame) return p._main(frame, 'Flagdeco', 'uxx', false) end | function p.deco(frame) return p._main(frame, 'Flagdeco', 'uxx', false) end | ||
function p.icon(frame) return p._main(frame, 'Flagicon', 'cxxl', true ) end | function p.icon(frame) return p._main(frame, 'Flagicon', 'cxxl', true ) end | ||
return p | return p | ||
Revision as of 14:27, 8 June 2020
Documentation for this module may be created at Module:Flag/sandbox/doc
local p = {}
function p._main(frame, name, mode, check)
local args={}
for k,v in pairs(frame:getParent().args) do
if (v or '') ~= '' then
args[k] = v
end
end
for k,v in pairs(frame.args) do
if (v or '') ~= '' then
args[k] = v
end
end
if check then
local opts = {
unknown=frame:expandTemplate{ title = 'main other', args = { '[[Category:Pages using ' .. mw.ustring.lower(name) .. ' template with unknown parameters|_VALUE_' .. frame:getParent():getTitle() .. ']]' } },
preview='Page using [[Template:' .. name .. ']] with unknown parameter "_VALUE_"',
ignoreblank='y',
[1] = '1',
[2] = '2',
[3] = 'variant',
[4] = 'image',
[5] = 'size',
[6] = 'sz',
[7] = 'border',
[8] = 'align',
[9] = 'al',
[10]= 'width',
[11]= 'w',
[12]= 'alt',
[13]= 'ilink',
[14]= 'noredlink',
[15]= 'missingcategory',
[16]= 'name',
[17]= 'clink',
[18]= 'link',
[19]= 'pref',
[20]= 'suff',
[21]= 'plink',
[22]= 'the',
[23]= 'section',
[24]= 'altvar',
[25]= 'avar',
[26]= 'age',
[27]= 'nalign',
[28]= 'nal',
[29]= 'text',
[30]= 'nodata',
[31]= 'opts'
}
check = require('Module:Check for unknown parameters')._check(opts,args)
else
check = ''
end
args['variant'] = args[2] or args['variant']
args[2] = args[1]
args[1] = mode .. (args['opts'] and args['opts'] or '')
args['missingcategory'] = '[[Category:' .. name .. 'with missing country data templates]]'
args['noredlink'] = args['noredlink'] or 'no'
if require('Module:Yesno')(args['placeholder']) ~= true then
args[1] = args[1] .. 'o'
end
return require('Module:Flagg/sandbox').luaMain(frame,args)..check
end
function p.main(frame) return p._main(frame, 'Flag', 'uncb', false) end
function p.deco(frame) return p._main(frame, 'Flagdeco', 'uxx', false) end
function p.icon(frame) return p._main(frame, 'Flagicon', 'cxxl', true ) end
return p