local p = {}
local function _main( args )
local sep = '
'local lastseplocal t = {}for i, v in ipairs( args ) dotable.insert( t, v )if mw.ustring.match( v, '%S' ) thentable.insert( t, sep )lastsep = #t
end
endif lastsep thentable.remove( t, lastsep )
endreturn table.concat( t )
end
function p.main( frame ) local origArgsif frame == mw.getCurrentFrame() then-- We're being called via #invoke. If the invoking template passed any arguments,-- use them. Otherwise, use the arguments that were passed into the template.origArgs = frame:getParent().argsfor k, v in pairs( frame.args ) doorigArgs = frame.argsbreak end else -- We're being called from another module or from the debug console, so assume-- the arguments are passed in directly.origArgs = frame end-- Use integer args only, and allow for explicit positional arguments-- that are specified out of order, e.g. 틀:Br separated entries.-- After processing, the args can be accessed accurately from ipairs.local args = {}for k, v in pairs( origArgs ) doif type( k ) == 'number' and k >= 1 and math.floor( k ) == k thentable.insert( args, k ) end endtable.sort( args )for i,v in ipairs( args ) doargs[ i ] = origArgs[ v ] endreturn _main( args ) end
return p