Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Srolanh/Table
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!
-- start local p = {} local HtmlBuilder = require('Module:HtmlBuilder') local root = HtmlBuilder.create() function p.col2_table(frame) local colspan = string.lower(frame.args[1]) local border = string.lower(frame.args[2]) if colspan == 'n' then local header1 = frame.args[3] local header2 = frame.args[4] local _table_ = root.tag('table') if border == 'y' then _table_.css('border', '1px') elseif border == 'n' then _table_.css('border', '0px') else return 'Error in parameter 2, must be Y or N' end local tr1 = root.tag('tr') local th1 = root.tag('th') th1.wikitext(header1) root = th1.done() local th2 = root.tag('th') th2.wikitext(header2) root = th2.done() root = tr1.done() local tr2 = root.tag('tr') local td1cont = frame.args[5] local td2cont = frame.args[6] local td1 = root.tag('td') td1.wikitext(td1cont) root = td1.done() local td2 = root.tag('td') td2.wikitext(td2cont) root = td2.done() root = tr2.done() root = _table_.done() elseif colspan == 'y' then local header = frame.args[3] local _table_ = root.tag('table') if border == 'y' then _table_.css('border', '1px') elseif border == 'n' then _table_.css('border', '0px') else return 'Error in parameter 2, must be Y or N' end local tr1 = root.tag('tr') local th = root.tag('th') th.wikitext(header) th.attr('colspan', '2') root = th.done() root = tr1.done() local tr2 = root.tag('tr') local td1cont = frame.args[4] local td2cont = frame.args[5] local td1 = root.tag('td') td1.wikitext(td1cont) root = td1.done() local td2 = root.tag('td') td2.wikitext(td2cont) root = td2.done() root = tr2.done() root = _table_.done() else return 'Error in parameter 1, must be Y or N' end html = tostring(root) return html end return p -- end
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:Sandbox/Srolanh/Table/doc
(
edit
)