Content deleted Content added
The Mol Man (talk | contribs) No edit summary |
m Protected "Module:ColPollTable": High-risk Lua module: requested at WP:RFPP ([Edit=Require autoconfirmed or confirmed access] (indefinite) [Move=Require autoconfirmed or confirmed access] (indefinite)) |
||
(16 intermediate revisions by 2 users not shown) | |||
Line 23:
default = { ['background-color'] = 'white' }
}
function p.doc(frame)
local desc = {
{'r', 'red'},
{'d', 'down'},
{'g', 'green'},
{'u', 'up'},
{'y', 'yellow'},
{'npr', 'not previously ranked'},
{'tg', 'tie green'},
{'tu', 'tie up'},
{'tr', 'tie red'},
{'td', 'tie down'},
{'ty', 'tie yellow'},
{'tnpr', 'tie not previously ranked'},
{'tw', 'tie white'},
{'-', 'default'}
}
local ret = mw.html.create('table'):addClass('wikitable')
ret:tag('tr')
:tag('th'):wikitext('Code'):done()
:tag('th'):wikitext('Abbreviation for'):done()
:tag('th'):wikitext('Result'):done()
for i=1,#desc do
local d = desc[i]
local c = string.lower(d[1])
local s = CC_backgrounds[c] or CC_backgrounds.default
ret:tag('tr')
:tag('td'):wikitext(c):done()
:tag('td'):wikitext(d[2]):done()
:tag('td'):css(s):done()
end
return ret
end
function p.main(frame)
Line 32 ⟶ 65:
-- get highest number looked at
--
local max_week = 0
for i=1,
if not args['Week'..i] then
break
end
max_week = i
end
local max_sub_week = 0
-- get the highest subweek to look at
-- Week1-Y should suffice, assuming all parameters require definition
for i=1,50 do
if not args['Week1-'..i] then
break
end
max_sub_week = i
end
local tbl_args = {
max = max_week,
max_sub = max_sub_week,
weeks = {}
}
Line 53 ⟶ 97:
for i=1,max_week do
local week_tbl = {}
week_tbl.name = 'Week ' .. argOrCall('Week'..i)
week_tbl.date = argOrCall('Week'..i..'Date')
week_tbl.cells = {}
for j=1,
local wkdt = string.format('Week%s-%s',i,j)
local wkcolor = string.format('Week%s-%s
wkdt = argOrCall(wkdt)
wkcolor = string.lower(argOrCall(wkcolor))
Line 68 ⟶ 112:
end
local dropped = args['Week'..i..'Dropped']
if not dropped or not
dropped = nil
end
Line 76 ⟶ 120:
-- week 1 is 0 --> "Preseason"
if tbl_args.weeks[1] and tbl_args.weeks[1].name == 'Week 0' then
tbl_args.weeks[1].name = 'Preseason'
end
--
if tbl_args.weeks[
local
if
tbl_args.weeks[
end
end
Line 94 ⟶ 138:
function p._main(args)
local ret = mw.html.create('div'):css('overflow', 'auto')
-- return table
local
:addClass('wikitable')
:css({ ['font-size'] = '90%',
Line 102 ⟶ 147:
-- header
local header_row =
for _, v in ipairs(args.weeks) do
header_row:tag('th'):wikitext(v.name)
:tag('br', { selfClosing = true }):done() :wikitext(v.date):done() end
header_row:tag('th'):done():done()
for i=1,
local cur_row =
cur_row:tag('th'):wikitext(i..'.'):done()
for _, v in ipairs(args.weeks) do
Line 122 ⟶ 169:
-- footer
local footer_row =
for _, v in ipairs(args.weeks) do
footer_row:tag('
:tag('br', { selfClosing = true }):done() :wikitext(v.date):done() end
Line 131 ⟶ 180:
-- drop outs
local dropped_row =
dropped_row:tag('td'):attr('colspan','2'):css({ background = 'transparent', ['border-bottom-style'] = 'hidden', ['border-left-style
for
if v.dropped and i > 1 then
dropped_row:tag('td'):css({ ['vertical-align'] = 'top', ['background-color'] = '#FFE6E6' })
:tag('b'):wikitext('Dropped:'):done()
:tag('br', { selfClosing = true }):done()
:wikitext(v.dropped)
:done()
elseif i > 1 then
dropped_row:tag('td'):css({ ['vertical-align'] = 'top', ['background-color'] = '#FFFFFF' })
:tag('i'):wikitext('None'):done()
Line 146 ⟶ 196:
end
end
dropped_row:tag('td'):css({ background = 'transparent', ['border-bottom-style'] = 'hidden', ['border-right-style
return ret
|