Module:Proposal support: Difference between revisions
From Tardis Wiki, the free Doctor Who reference
Bongolium500 (talk | contribs) No edit summary Tag: Reverted |
Bongolium500 (talk | contribs) No edit summary |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
function p.proposalSupport(frame) | function p.proposalSupport(frame) | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
local supporters = 0 | |||
local list = "" | local list = "" | ||
for | for _, sig in ipairs(args) do | ||
list = list .. "\n* " .. | if sig ~= "" and sig ~= " " and not list:find(sig, 1, true) then | ||
list = list .. "\n* " .. sig:gsub("\n", "") | |||
supporters = supporters + 1 | |||
end | |||
end | end | ||
local final = '<div data-sort-value="' .. supporters .. '">' .. list .. '\n</div>' | local s = "s" | ||
return final | if supporters == 1 then s = "" end | ||
local final = '<div data-sort-value="' .. supporters .. '">' .. supporters .. ' supporter' .. s .. list .. '\n</div>' | |||
return final | |||
end | end | ||
return p | return p |
Latest revision as of 18:40, 9 March 2023
Documentation for this module may be created at Module:Proposal support/doc
local p = {}
function p.proposalSupport(frame)
local args = frame:getParent().args
local supporters = 0
local list = ""
for _, sig in ipairs(args) do
if sig ~= "" and sig ~= " " and not list:find(sig, 1, true) then
list = list .. "\n* " .. sig:gsub("\n", "")
supporters = supporters + 1
end
end
local s = "s"
if supporters == 1 then s = "" end
local final = '<div data-sort-value="' .. supporters .. '">' .. supporters .. ' supporter' .. s .. list .. '\n</div>'
return final
end
return p