7,770 Pages

Documentation for this module may be created at Module:Tri/doc

local a={}local b=require("Module:TableTools")local d="([;~\[].*)"function a.g(e,f,g,h)f=f or''g=g or{}h=h or{}local i={}for j,k in pairs(e)do if k.parent==f then i[j]=k end end;if b.size(i)>0 then if f==''then h=i else table.insert(g,i)end;for j,k in pairs(i)do a.g(e,j,k)end end;return h end;function a.m(h,l,m,n)local o=""local p=""if not n then return a.m(h,l,m,0)end;if l then for q=0,n do p=p.."*"end end;for j,k in pairs(h)do if type(k)=="table"then if type(j)=="number"then if l then o=o..string.sub(p,1,-n-2)..a.m(k,l,m,n)else o=o..a.m(k,false,',',n)end else local r=j;if k["extra"]then r=j..k["extra"]end;if l then r=p..l:preprocess("{{SemanticInputParser|value="..r.."}}")else r=n.."_"..r end;o=o..r..m..a.m(k,l,m,n+1)end end end;return o end;function a.from_csv(l)local s=function(t)return mw.text.trim(string.gsub(t,d,''),"\t\r\n\f ")end;if#s(l.args[1])<1 then return''end;local u=mw.text.split(l.args[1],'%s*,%s*')local e={}for v,w in ipairs(u)do local x=s(w)if#x>0 then local y=string.match(w,d)local z=l:preprocess("{{#show:"..x.."|?Parent|+index=1|format=array}}")local A=mw.text.split(z,"<MANY>")s_available_parent=''for q,B in ipairs(A)do for C,D in ipairs(u)do if B==s(D)then s_available_parent=B;break end end end;e[x]={["parent"]=s_available_parent,["extra"]=y}end end;local E=false;local m=','if l.args[2]then E=l;m='\n'end;return a.m(a.g(e),E,m)end;return a
Community content is available under CC-BY-SA unless otherwise noted.