Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Tree chart
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
require('strict') local p = {} local cells = mw.loadData('Module:Tree chart/data') function p._main(cell_args) local ret = mw.html.create() local top = ret:tag('tr') :css{ height = '1px', ['text-align'] = 'center' } local bottom = ret:tag('tr') :css{ height = '1px', ['text-align'] = 'center' } 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{ colspan = v.colspan or cell_args.colspan or 6, rowspan = v.rowspan or cell_args.rowspan or 2 } :css{ padding = '0.2em', border = (v.border or cell_args.border or '2') .. 'px solid black' } :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, {wrappers = 'Template:Tree chart', trim = false, removeBlanks = false}) local cell_args = { colspan = args.colspan, rowspan = args.rowspan, border = args.border, boxstyle = args.boxstyle } 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_{{{1}}}, but not whitespace at the end, so remove it local rightTrimmedVal = val:gsub('%s+$','') table.insert(cell_args, { text = args[trimmedVal] or ('{{{'..trimmedVal..'}}}'), colspan = args['colspan_'..rightTrimmedVal], rowspan = args['rowspan_'..rightTrimmedVal], border = args['border_'..rightTrimmedVal], boxstyle = args['boxstyle_'..rightTrimmedVal] }) end end return p._main(cell_args) end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Tree chart/doc
(
edit
)