Module:ColPollTable: Difference between revisions

Content deleted Content added
wrap in scrollbox
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))
 
(8 intermediate revisions by one other user 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)