Module:Xpd

-- Expansion demo, like Template:Xpd -- p.u is for calls with unnamed parameters only

local p = {} function p.u(frame) local r='' local t={} for n,v in frame:argumentPairs do table.insert (t,{n,v}) end local tplname tplargs={} tplargs[1]='' for i,nv in pairs(t) do  if i==1 then tplname=nv[2] else tplargs[nv[1]]=nv[2] end end table.remove (tplargs,1) r=r..' → ' r=r..frame:expandTemplate{title=tplname,args=tplargs} return r end function p.nu(frame) local r='' local t={} for n,v in frame:argumentPairs do    if type(n)==number then t[n-1]=v else t[n]=v end end local tplname tplargs={} tplargs[1]='' for n,v in pairs(t) do  if n==1 then tplname=v else tplargs[n]=v end end table.remove (tplargs,1) r=r..' → ' r=r..'\n\n'..frame:expandTemplate{title=tplname,args=tplargs} return r end return p