Module:Tabs: Difference between revisions

Jump to navigation Jump to search
No edit summary
No edit summary
Line 136: Line 136:
i = i + 2
i = i + 2
until args[i+1] == nil or args[i+2] == nil
until args[i+1] == nil or args[i+2] == nil
local output = mw.html.create( 'div' ):addClass('tab-container'):wikitext( 'Tab container' ):node(header):node(contents)


return header, contents
return output
else
else
return 'Values not filled.'
return 'Values not filled.'

Revision as of 01:26, 14 July 2024

Documentation for this module may be created at Module:Tabs/doc

local getArgument = require('Module:Arguments').getArgument

local p = {}

function p.Main(frame)
	local args = frame.args
	local i = 0
	local gamesOrder = {
	    ['mt1'] = 2,
	    ['mt2'] = 3,
	    ['kmt'] = 4,
	    ['smt1'] = 5,
	    ['smt2'] = 6,
	    ['smtif'] = 7,
	    ['smtn'] = 8,
	    ['smt3'] = 9,
	    ['smt3nm'] = 10,
	    ['smtsj'] = 11,
	    ['smtsjr'] = 12,
	    ['smt4'] = 13,
	    ['smt4a'] = 14,
	    ['smt5'] = 15,
	    ['smt5v'] = 16,
	    ['gmt'] = 17,
	    ['smti'] = 18,
	    ['smtsp'] = 19,
	    ['dsp'] = 20,
	    ['kad'] = 21,
	    ['smtj'] = 22,
	    ['20xx'] = 23,
	    ['dc20xx'] = 24,
	    ['smtifh'] = 25,
	    ['smttr'] = 26,
	    ['smt2g'] = 27,
	    ['dhz'] = 28,
	    ['smtdc'] = 29,
	    ['dx2'] = 30,
	    ['lb1'] = 31,
	    ['rds'] = 32,
	    ['lb2'] = 33,
	    ['lb3'] = 34,
	    ['ab'] = 35,
	    ['lbs'] = 36,
	    ['slb1'] = 37,
	    ['slb2'] = 38,
	    ['slb3'] = 39,
	    ['mjt1'] = 40,
	    ['mjt2'] = 41,
	    ['r'] = 42,
	    ['mjtbt1'] = 43,
	    ['mjtbt2'] = 44,
	    ['desum'] = 45,
	    ['sh1'] = 46,
	    ['sh2'] = 47,
	    ['sh1'] = 48,
	    ['shed'] = 49,
	    ['sh2'] = 50,
	    ['dsrk1'] = 51,
	    ['dsrk2'] = 52,
	    ['smtpj'] = 53,
	    ['shi'] = 54,
	    ['shng'] = 55,
	    ['mip'] = 56,
	    ['rp'] = 57,
	    ['p1'] = 58,
	    ['p2is'] = 59,
	    ['p2ep'] = 60,
	    ['p3'] = 61,
	    ['p3f'] = 62,
	    ['p3p'] = 63,
	    ['p3r'] = 64,
	    ['p4'] = 65,
	    ['p4g'] = 66,
	    ['p5'] = 67,
	    ['p5r'] = 68,
	    ['p4a'] = 69,
	    ['p4au'] = 70,
	    ['pq1'] = 71,
	    ['pq2'] = 72,
	    ['p4d'] = 73,
	    ['p3d'] = 74,
	    ['p5d'] = 75,
	    ['p5s'] = 76,
	    ['p5t'] = 77,
	    ['p5x'] = 78,
	    ['pith'] = 79,
	    ['qp3'] = 80,
	    ['csp3'] = 81,
	    ['p2tlm'] = 82,
	    ['atfm'] = 83,
	    ['p3m'] = 84,
	    ['ipp3'] = 85,
	    ['p3bs'] = 86,
	    ['p2bim'] = 87,
	    ['pmo'] = 88,
	    ['p3s'] = 89,
	    ['p3e'] = 90,
	    ['p4c'] = 91,
	    ['p4cb'] = 92,
	    ['poa'] = 93,
	    ['dcb'] = 94,
	    ['dcr'] = 95,
	    ['dcbr'] = 96,
	    ['dcw'] = 97,
	    ['dcl'] = 98,
	    ['dcd'] = 99,
	    ['dcld'] = 100,
	    ['dcf'] = 101,
	    ['dci'] = 102,
	    ['dcfi'] = 103,
	    ['dcpdc'] = 104,
	    ['dcmr'] = 105,
	    ['dcadc'] = 106,
	    ['dcm'] = 107,
	    ['dccg'] = 108,
	    ['ddsat1'] = 109,
	    ['ddsat2'] = 110,
	    ['ats'] = 111,
	    ['desu1'] = 112,
	    ['desu1oc'] = 113,
	    ['desu2'] = 114,
	    ['desu2rb'] = 115,
	    ['desu2ew'] = 116,
	    ['jb'] = 117,
	    ['smttc'] = 118,
	    ['tms'] = 119,
	    ['tmse'] = 120,
	    ['jqat'] = 121
	}
	if args[1] and args[2] then
		local header = mw.html.create( 'div' ):addClass('tab-header'):wikitext( 'Tab header' )
		local contents = mw.html.create( 'div' ):addClass('tab-contents'):wikitext( 'Tab contents' )
		repeat
			header = header:node(mw.html.create( 'span' ):addClass('tab'):wikitext(args[i+2]))
			contents = contents:node(mw.html.create( 'div' ):addClass('tab-content'):wikitext(args[i+1]))
			i = i + 2
		until args[i+1] == nil or args[i+2] == nil
		local output = mw.html.create( 'div' ):addClass('tab-container'):wikitext( 'Tab container' ):node(header):node(contents)

		return output
	else
		return 'Values not filled.'
	end
end

return p