Module:TooltipShop

local p = {} local rtable = require( 'Module:Table' )

function p.main( f ) local args = rtable.trimAll( rtable.getArgs( f ) )

local block = mw.html.create( 'span' ) block:attr( 'class', 'tooltip-block-shop ' .. ( args.class or '' ) ) :cssText( args.style )

if args['row 1'] or args['row 1 cell 1'] then local row = 1 while args['row ' .. row] or args['row ' .. row .. ' cell 1'] do           local rowHMTL = mw.html.create( 'span' ) rowHMTL:attr( 'class', 'tooltip-row ' .. ( args['row class'] or '' ) .. ' ' .. ( args['row ' .. row .. ' class'] or '' ) ) :cssText( ( args['row style'] or '' ) .. ';' .. ( args['row ' .. row .. ' style'] or '' ) )

if args['row ' .. row .. ' cell 1'] then local cell = 1 while args['row ' .. row .. ' cell ' .. cell] do                   local cellHTML = mw.html.create( 'span' ) cellHTML:attr( 'class', 'tooltip-cell ' .. ( args['cell class'] or '' ) .. ' ' .. ( args['row ' .. row .. ' cell class'] or '' ) .. ' ' .. ( args['row ' .. row .. ' cell ' .. cell .. ' class'] or '' ) ) :cssText( ( args['cell style'] or '' ) .. ';' .. ( args['row ' .. row .. ' cell style'] or '' ) .. ';' .. ( args['row ' .. row .. ' cell ' .. cell .. ' style'] or '' ) ) :wikitext( args['row ' .. row .. ' cell ' .. cell] ) rowHMTL:node( cellHTML ) cell = cell + 1 end else local cellHTML = mw.html.create( 'span' ) cellHTML:attr( 'class', 'tooltip-cell ' .. ( args['cell class'] or '' ) .. ' ' .. ( args['row ' .. row .. ' cell class'] or '' ) ) :cssText( ( args['cell style'] or '' ) .. ';' .. ( args['row ' .. row .. ' cell style'] or '' ) ) :wikitext( args['row ' .. row] ) rowHMTL:node( cellHTML ) end

block:node( rowHMTL ) row = row + 1 end else local rowHMTL = mw.html.create( 'span' ) rowHMTL:attr( 'class', 'tooltip-row ' .. ( args['row class'] or '' ) ) :cssText( args['row style'] )

if args['cell 1'] then local cell = 1 while args['cell ' .. cell] do               local cellHTML = mw.html.create( 'span' ) cellHTML:attr( 'class', 'tooltip-cell ' .. ( args['cell class'] or '' ) .. ' ' .. ( args['cell ' .. cell .. ' class'] or '' ) ) :cssText( ( args['cell style'] or '' ) .. ';' .. ( args['cell ' .. cell .. ' style'] or '' ) ) :wikitext( args['cell ' .. cell] ) rowHMTL:node( cellHTML ) cell = cell + 1 end else local cellHTML = mw.html.create( 'span' ) cellHTML:attr( 'class', 'tooltip-cell ' .. ( args['cell class'] or '' ) ) :cssText( args['cell style'] ) :wikitext( args.cell ) rowHMTL:node( cellHTML ) end

block:node( rowHMTL ) end

local content = mw.html.create( 'span' ) content:attr( 'class', 'notitle tooltip' ) :wikitext( args['content'] or args[1] ) :node( block )

return content end

return p