Module:Signpost poll
Appearance
![]() | This module depends on the following other modules: |
This module implements Wikipedia:Wikipedia Signpost/Templates/Voter.
-- This module implments polls used in articles of the Signpost.
-- Color definitions:
local FOUNDATION_BLUE = '#006699'
local FOUNDATION_GREEN = '#339966'
local FOUNDATION_RED = '#990000'
--[[
We need:
preload - use a standard preload and pass the option text in by parameter.
image
question
option1
option1vote - the vote text to use for option one - defaults to option1
option1color
option2
option2vote
option2color
...
min_votes
break - if 'all', breaks on all options; if a number, breaks after that number option
overlay
expiry
]]
local p = {}
local function makeColorTable(n)
-- Make a table of color strings for a poll with n colors.
local defaults = {FOUNDATION_BLUE, FOUNDATION_GREEN, FOUNDATION_RED}
local ret = {}
if n <= #defaults then
for i = 1, n do
ret[n] = defaults[n]
end
else
error(string.format(
'attempt to make a color table with %d colors; only %d colors are supported',
n, #defaults
), 2)
end
return ret
end
function p._main(args)
end
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {
wrappers = 'Wikipedia:Wikipedia Signpost/Templates/Voter'
})
return p._main(args)
end
return p