-- Implements local p = local eventschema = "http://schema.org/SportsEvent"local labels =
local function isnotempty(s) return s and s:match('^%s*(.-)%s*$') ~= end
local function trim(s) if isnotempty(s) then s = s:match('^[\'"%s]*(.-)[\'"%s]*$') return isnotempty(s) and s or nil end return nilend
local function getid(s) s = trim(s or ) if s and s ~= then return s end return nilend
function p.main(frame) local getArgs = require('Module:Arguments').getArgs local args = getArgs(frame) local id = getid(args['id']) -- start box local root = mw.html.create('div') :attr('itemscope', ) :attr('itemtype', eventschema) :css('width', args['size'] or '100%') :css('background-color', args['bg']) :addClass('vevent summary') :attr('id', id) -- date/time/round local dtr = for _, v in pairs do if args[v] then table.insert(dtr, args[v]) end end root:tag('table') :css('float', 'left') :css('width', args['cw1'] or '15%') :css('table-layout', 'fixed') :tag('tr') :tag('td') :css('text-align', 'right') :wikitext(table.concat(dtr, '
')) local block = root:tag('table') :css('float', 'left') :css('width', args['cw2'] or '61%') :css('table-layout', 'fixed') :css('text-align', 'center')
local row = block:tag('tr') :css('vertical-align', 'top') :css('font-weight', 'bold') row:tag('td') :css('width', '39%') :css('text-align', 'right') :addClass('vcard') :tag('span') :addClass('fn org') :wikitext(args['team1'] or args['home'] or args['nohome']) row:tag('td') :css('width', '22%') :wikitext(args['score'] or 'v') :wikitext(args['aet'] and ' (' .. labels['aet'] .. ')' or nil) row:tag('td') :css('width', '39%') :css('text-align', 'left') :addClass('vcard') :tag('span') :addClass('fn org') :wikitext(args['team2'] or args['away'] or args['noaway'])
row = block:tag('tr') :css('font-size', '85%') :css('vertical-align', 'top') local score = for k = 1,2 do if score[k]
return p