Documentation for this module may be created at Module:Test/doc
local p = {}
function p.ProtoFlux( frame )
local inputsDecode = mw.text.jsonDecode( frame.args.Inputs );
local outputsDecode = mw.text.jsonDecode( frame.args.Outputs );
local numInputs = #inputsDecode;
local numOuputs = #outputsDecode;
local protofluxContainer = mw.html.create( 'table' )
protofluxContainer
:tag( 'tr' )
:tag( 'th' )
:attr('width', '20%')
:done()
:tag( 'th' )
:attr('width', '80%')
:wikitext(frame.args.Name)
:done()
:tag( 'th')
:attr('width', '20%');
CreateIORow(protofluxContainer, inputsDecode[1], outputsDecode[1]);
return tostring(protofluxContainer);
end
-- Each Input/Output row is really 2 rows high.
function CreateIORow(Container, Input, Output)
Container
:tag( 'tr' )
:tag( 'td' ) -- The Input binding post
:attr( 'rowspan', '2' )
:attr( 'bgcolor', 'red' )
:done()
:tag( 'td' ) -- The Input name
:wikitext( Input.Name .. ' = ' .. Input.Type )
:done()
:tag( 'td' ) -- The Output binding post
:attr( 'rowspan', '2' )
:attr( 'bgcolor', 'blue' )
:done()
:done()
:tag( 'tr')
:tag( 'td' )
:wikitext( Output.Name .. ' = ' .. Output.Type )
:done()
end
return p