Module:List helper
Documentation for this module may be created at Module:List helper/doc
-- note: I have no idea what I'm doing
-- attempt at luaizing wikt:Template:List helper
local z = {}
function z.main(frame)
local args = frame:getParent().args
local i = 1
local o = ""
local bl = "[["
if( args["appendixonly"] ~= nil ) then
bl = "[[Appendix:" .. args["appendixonly"] .. "/"
end
local ss = "/"
if( args["synseparator"] == "no" ) then ss = "" end
local lang = '#' .. frame:expandTemplate{title='languagex', args = { args["lang"] or "en" }}
while args[i] ~= nil do
local arg = args[i]
if( i > 1 ) then o = o .. ",‎ " end
if( string.find(arg, "[%[%]|{}<>") ~= nil ) then o = o .. arg else
o = o .. bl .. arg .. lang .. "|" .. arg .. "]]"
end
local synn = ""
while true do
local syn = args[ i .. "syn" .. synn ]
if ( synn == "" ) then synn = 2 else synn = synn + 1 end
if ( syn ~= nil ) then
if ( string.find(syn, "[%[%]|{}<>") ~= nil ) then
o = o .. ss .. syn
else
o = o .. ss .. bl .. syn .. lang .. "|" .. syn .. "]]"
end
else
break
end
end
i = i + 1
end
return o
end
return z