Module:RfX tally

MyWikiBiz, Author Your Legacy — Friday July 05, 2024
Revision as of 05:39, 16 July 2021 by Zoran (talk | contribs) (Pywikibot 6.4.0)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Implements {{RfX tally}}


local p = {}
local rfx = require("Module:Rfx")
function p.main(frame)
	local title = mw.text.trim(frame.args[1])
	local obj
	if title == nil or #title == 0 then
		obj = rfx.new(mw.title.getCurrentTitle().fullText)
	else
		obj = rfx.new("Wikipedia:Requests for bureaucratship/" .. title)
		if obj == nil then
			obj = rfx.new("Wikipedia:Requests for adminship/" .. title)
		end	
	end
	if obj == nil then
		return "(?/?/?)"
	else
		return string.format("(%s/%s/%s)",obj.supports,obj.opposes,obj.neutrals)
	end
end
return p