localp={}localfunction_main(args)localsep='<br />'locallastseplocalt={}fori,vinipairs(args)dotable.insert(t,v)ifmw.ustring.match(v,'%S')thentable.insert(t,sep)lastsep=#tendendiflastsepthentable.remove(t,lastsep)endreturntable.concat(t)endfunctionp.main(frame)localorigArgsifframe==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().argsfork,vinpairs(frame.args)doorigArgs=frame.argsbreakendelse-- We're being called from another module or from the debug console, so assume-- the arguments are passed in directly.origArgs=frameend-- Use integer args only, and allow for explicit positional arguments-- that are specified out of order, e.g. {{br separated entries|3=entry3}}.-- After processing, the args can be accessed accurately from ipairs.localargs={}fork,vinpairs(origArgs)doiftype(k)=='number'andk>=1andmath.floor(k)==kthentable.insert(args,k)endendtable.sort(args)fori,vinipairs(args)doargs[i]=origArgs[v]endreturn_main(args)endreturnp