Jump to content

Module:RfD close

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Deryck Chan (talk | contribs) at 22:44, 21 February 2017 (Implement Eureka Lott's idea first because it's less conspicuous and less controversial). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local rfd = {}

function rfd.rfdt_collapsebox(frame) --this bit creates the "closed discussion" notice
	--define function to check whether arguments are defined
	local args = frame.args

	local function argIsSet(key)
		if args[key] and args[key]:find('%S') then
			return true
		else
			return false
		end
	end
	
	local message_string1 = '<includeonly>[[File:Symbol move vote.svg|16px|link=|alt=]] '
	.. "'''Closed discussion''', see [["
	
	local timestamp_string = os.time()
	
	local link_string = tostring(mw.title.getCurrentTitle()) ..  '#' .. timestamp_string
	
	local message_string2 = '|full discussion]].'
	
	local result_string = ''
	
	if (argIsSet('result')) then
		result_string = ' Result was: ' .. frame.args['result']
	end
	
	local end_string = '</includeonly><noinclude><span id="' .. timestamp_string .. '"></span>'

	return message_string1 .. link_string .. message_string2 .. result_string .. end_string
end

function rfd.rfdb_noinclude(frame)
	return '</noinclude>'
end

return rfd