Module:Tabs: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 8: | Line 8: | ||
if args[1] and args[2] then | if args[1] and args[2] then | ||
local header = mw.html.create( 'div' ):addClass('tab- | local header = mw.html.create( 'div' ):addClass('tab-header') | ||
local contents = mw.html.create( 'div' ):addClass('tab- | local contents = mw.html.create( 'div' ):addClass('tab-contents') | ||
repeat | repeat | ||
header = header:node(mw.html.create( 'span' ):addClass('tab'):wikitext(args[i+2])) | header = header:node(mw.html.create( 'span' ):addClass('tab'):wikitext(args[i+2])) |
Revision as of 01:37, 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 if args[1] and args[2] then local header = mw.html.create( 'div' ):addClass('tab-header') local contents = mw.html.create( 'div' ):addClass('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