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)) |
||
(11 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 53 ⟶ 86:
local tbl_args = {
max = max_week,
max_sub = max_sub_week,
weeks = {}
}
Line 86 ⟶ 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
Line 104 ⟶ 138:
function p._main(args)
local ret = mw.html.create('div'):css('overflow', 'auto')
-- return table
local
:addClass('wikitable')
:css({ ['font-size'] = '90%',
Line 112 ⟶ 147:
-- header
local header_row =
for _, v in ipairs(args.weeks) do
Line 122 ⟶ 157:
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 134 ⟶ 169:
-- footer
local footer_row =
for _, v in ipairs(args.weeks) do
Line 145 ⟶ 180:
-- drop outs
local dropped_row =
dropped_row:tag('td'):attr('colspan','2'):css({ background = 'transparent', ['border-bottom-style'] = 'hidden', ['border-left-style'] = 'hidden' }):done()
|