Module:Tree chart/sandbox explained

require('strict')

local p =

local cells = mw.loadData('Module:Tree chart/data/sandbox')

function p._main(cell_args) local ret = mw.html.create local top = ret:tag('tr') :css local bottom = ret:tag('tr') :css for _, v in ipairs(cell_args) do if type(v)

'string' then top:wikitext(cells[v].t) bottom:wikitext(cells[v].b) else top:tag('td') :attr :css :cssText(v.boxstyle or cell_args.boxstyle) :wikitext(v.text) end end return tostring(ret)end

function p.main(frame) local args = require('Module:Arguments').getArgs(frame,) local cell_args = for _, val in ipairs(args) do local trimmedVal = val:match('^%s*(.-)%s*$') if trimmedVal

then trimmedVal = '$' end if cells[trimmedVal] then table.insert(cell_args, trimmedVal) else -- Unnamed params behave weirdly -- white space at the front counts for param_, but not whitespace at the end, so remove it local rightTrimmedVal = val:gsub('%s+$',) table.insert(cell_args,) end end return p._main(cell_args)end

return p