Module:Sandbox/XarrotD

local p = {} local result = {}

function p:TestHTML(frame) local div1 = mw.html.create( 'ul' ) local div1sub = mw.html.create( 'li' ) div1sub:wikitext( 'This is some text.' ) div1:node( div1sub ) local div2 = mw.html.create( 'ul' ) local div2sub = mw.html.create( 'li' ) div2sub:wikitext( 'This is some more text.' ) div2:node( div2sub ) local div3 = mw.html.create( 'ul' ) local div3sub = mw.html.create( 'li' ) div3sub:wikitext( 'This is also text.' ) div3:node( div3sub ) local div = mw.html.create( 'div' ) div :attr( 'class', 'list-columns' ) :css( 'column-width', '25em' ) :node( div1 ) :node( div2 ) :node( div3 ) return tostring(div) end

function p.TestHTML2(frame) return 'This is some text.' end

function p.TestHTML3(frame) local div1 = 		This is some text that will be formatted with a number later. The number is {number}.		 table.insert(result, div1) local div2 = 		This is some more text that will be formatted with a different number. The number is {number}.		 table.insert(result, div2) local div3 = 		This is even more text that will be formatted with an even differenter number. The number is {number}.		 table.insert(result, div3) return table.concat(result, '') end

function p.TestHTML4(frame) local div1 = This is some text that will be formatted with a number later. The number is %s. string.format(div1, frame.args[2]) table.insert(result, div1) local div2 = This is some more text that will be formatted with a different number. The number is %s.</li></ul> string.format(div2, frame.args[3]) table.insert(result, div2) local div3 = This is even more text that will be formatted with an even differenter number. The number is %s.</li></ul> string.format(div3, frame.args[4]) table.insert(result, div3) return table.concat(result, '') end

function p.Generate(frame) if frame.args[1] == '1' then return p:TestHTML(frame) elseif frame.args[1] == '2' then return p:TestHTML2(frame) elseif frame.args[1] == '3' then return p:TestHTML3(frame) elseif frame.args[1] == '4' then return p:TestHTML4(frame) end end

return p