<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AVENAClassnomination</id>
	<title>Module:VENAClassnomination - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AVENAClassnomination"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:VENAClassnomination&amp;action=history"/>
	<updated>2026-05-28T07:27:48Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:VENAClassnomination&amp;diff=147550&amp;oldid=prev</id>
		<title>imported&gt;Kingsif at 23:02, 28 October 2019</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:VENAClassnomination&amp;diff=147550&amp;oldid=prev"/>
		<updated>2019-10-28T23:02:46Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements {{VENAClassnomination}}.&lt;br /&gt;
&lt;br /&gt;
local lang = mw.language.getContentLanguage()&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Output template&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- This template contains the final output of the module. Parameters like&lt;br /&gt;
-- ${PARAMETER_NAME} are substituted with the results of the output template&lt;br /&gt;
-- parameter functions below.&lt;br /&gt;
&lt;br /&gt;
local OUTPUT_TEMPLATE = [=[&lt;br /&gt;
${MONTH_AND_YEAR}&lt;br /&gt;
* ${HEADING}&lt;br /&gt;
* ${COMMENT}&lt;br /&gt;
&amp;lt;small&amp;gt;${STATUS} by ${AUTHORS}. ${NOMINATED} at ~~~~~.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* &amp;lt;!-- REPLACE THIS LINE TO WRITE FIRST COMMENT, KEEPING   :*   --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--Please do not write below this line or remove this line. Place comments above this line.--&amp;gt;]=]&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Helper functions&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- Creates a formatted error message that can be used with substitution.&lt;br /&gt;
local function formatError(msg)&lt;br /&gt;
	return string.format(&amp;#039;{{error|1=%s}}&amp;#039;, msg)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Creates a boilerplate error message for invalid titles.&lt;br /&gt;
local function formatInvalidTitleError(page, pageType)&lt;br /&gt;
	local msg = string.format(&lt;br /&gt;
		&amp;#039;&amp;quot;%s&amp;quot; is not a valid %s; check for bad characters&amp;#039;,&lt;br /&gt;
		page, pageType&lt;br /&gt;
	)&lt;br /&gt;
	return formatError(msg)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Same as {{ROOTPAGENAME}}. If the page is an invalid title, returns nil.&lt;br /&gt;
local function getRootPageText(page)&lt;br /&gt;
	local title = mw.title.new(page)&lt;br /&gt;
	if title then&lt;br /&gt;
		return title.rootPageTitle.text&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Normalize positional parameters for a template invocation. If any of the&lt;br /&gt;
-- parameters contain equals signs, the parameters are all prefixed with&lt;br /&gt;
-- numbers.&lt;br /&gt;
local function normalizeTemplateParameters(params)&lt;br /&gt;
	local ret = {}&lt;br /&gt;
	local hasEquals = false&lt;br /&gt;
	for i, param in ipairs(params) do&lt;br /&gt;
		if param:find(&amp;#039;=&amp;#039;) then&lt;br /&gt;
			hasEquals = true&lt;br /&gt;
			break&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if hasEquals then&lt;br /&gt;
		for i, param in ipairs(params) do&lt;br /&gt;
			ret[i] = string.format(&amp;#039;%d=%s&amp;#039;, i, param)&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		for i, param in ipairs(params) do&lt;br /&gt;
			ret[i] = param&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Makes a link to a user&amp;#039;s user page and talk page, like found in a standard&lt;br /&gt;
-- signature.&lt;br /&gt;
local function makeUserLinks(user)&lt;br /&gt;
	return string.format(&lt;br /&gt;
		&amp;#039;[[User:%s|%s]] ([[User talk:%s|talk]])&amp;#039;,&lt;br /&gt;
		user, user, user&lt;br /&gt;
	)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Returns an array of authors. If the user didn&amp;#039;t specify any authors, the&lt;br /&gt;
-- first one is the result of {{REVISIONUSER}}.&lt;br /&gt;
local function getNormalisedAuthors(data)&lt;br /&gt;
	local authors = {}&lt;br /&gt;
	for i, author in ipairs(data.authors) do&lt;br /&gt;
		authors[i] = author&lt;br /&gt;
	end&lt;br /&gt;
	authors[1] = authors[1] or data.revisionUser&lt;br /&gt;
	return authors&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Removes gaps from sparse arrays. This is used to process numbered arguments&lt;br /&gt;
-- like author2 and ALT4.&lt;br /&gt;
local compressSparseArray = require(&amp;quot;Module:TableTools&amp;quot;).compressSparseArray&lt;br /&gt;
&lt;br /&gt;
-- Splits numbered arguments by their prefixes. A table of arguments like this:&lt;br /&gt;
--    {foo1 = &amp;quot;foo1&amp;quot;, foo2 = &amp;quot;foo2&amp;quot;, bar3 = &amp;quot;bar3&amp;quot;}&lt;br /&gt;
-- Would be turned into this:&lt;br /&gt;
--    {foo = {[1] = &amp;quot;foo1&amp;quot;, [2] = &amp;quot;foo2&amp;quot;}, bar = {[3] = &amp;quot;bar3&amp;quot;}}&lt;br /&gt;
-- Note that the subtables of the returned tables are not normal arrays, but&lt;br /&gt;
-- sparse arrays (there can be gaps between values).&lt;br /&gt;
local function splitByPrefix(args)&lt;br /&gt;
	local ret = {}&lt;br /&gt;
	for key, val in pairs(args) do&lt;br /&gt;
		if type(key) == &amp;#039;string&amp;#039; then&lt;br /&gt;
			local prefix, num = key:match(&amp;#039;^(.-)([1-9][0-9]*)$&amp;#039;)&lt;br /&gt;
			if prefix then&lt;br /&gt;
				num = tonumber(num)&lt;br /&gt;
				ret[prefix] = ret[prefix] or {}&lt;br /&gt;
				ret[prefix][num] = val&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Returns an array of numbered arguments with the given prefixes. Earlier&lt;br /&gt;
-- prefixes have precedence, and args[prefix] will overwrite args[prefix .. 1].&lt;br /&gt;
-- For example, for this arguments table:&lt;br /&gt;
--   {&lt;br /&gt;
--      author = &amp;quot;author&amp;quot;,&lt;br /&gt;
--      author1 = &amp;quot;author1&amp;quot;,&lt;br /&gt;
--      author2 = &amp;quot;author2,&lt;br /&gt;
--      creator2 = &amp;quot;creator2&amp;quot;&lt;br /&gt;
--   }&lt;br /&gt;
-- The function call getPrefixedArgs(args, splitArgs, {&amp;#039;creator&amp;#039;, &amp;#039;author&amp;#039;})&lt;br /&gt;
-- will produce:&lt;br /&gt;
--   {&amp;quot;author&amp;quot;, &amp;quot;creator2&amp;quot;}&lt;br /&gt;
--&lt;br /&gt;
-- Parameters:&lt;br /&gt;
-- args - the table of arguments specified by the user&lt;br /&gt;
-- splitArgs - the table of arguments as processed by splitByPrefix&lt;br /&gt;
-- prefixes - an array of prefixes&lt;br /&gt;
local function getPrefixedArgs(args, splitArgs, prefixes)&lt;br /&gt;
	local ret = {}&lt;br /&gt;
	for i, prefix in ipairs(prefixes) do&lt;br /&gt;
		if splitArgs[prefix] then&lt;br /&gt;
			for num, val in pairs(splitArgs[prefix]) do&lt;br /&gt;
				if not ret[num] then&lt;br /&gt;
					ret[num] = val&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- Allow prefix to overwrite prefix1.&lt;br /&gt;
	for _, prefix in ipairs(prefixes) do&lt;br /&gt;
		local val = args[prefix]&lt;br /&gt;
		if val then&lt;br /&gt;
			ret[1] = val&lt;br /&gt;
			break&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return compressSparseArray(ret)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Output template parameter functions&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- The results of these functions are substituted into parameters in the&lt;br /&gt;
-- output template. The parameters look like ${PARAMETER_NAME}. Trying to use&lt;br /&gt;
-- a parameter that doesn&amp;#039;t have a function defined here will result in an&lt;br /&gt;
-- error.&lt;br /&gt;
--&lt;br /&gt;
-- The functions take a data table as a single argument. This table contains&lt;br /&gt;
-- the following fields:&lt;br /&gt;
-- * errors - a table of formatted error messages that were found when&lt;br /&gt;
--     processing the input.&lt;br /&gt;
-- * args - the table of arguments supplied by the user.&lt;br /&gt;
-- * articles - an array of the article names found in the arguments.&lt;br /&gt;
-- * authors - an array of the expanders/creators/writers/authors found in the&lt;br /&gt;
--     arguments.&lt;br /&gt;
-- * revisionUser - the user that last edited the page. As this module is only&lt;br /&gt;
--     substitited, this is always the current user.&lt;br /&gt;
-- * alts - an array of the ALT hooks found in the arguments.&lt;br /&gt;
-- * title - the mw.title object for the current page.&lt;br /&gt;
--&lt;br /&gt;
-- Template parameter functions should return a string, false, or nil.&lt;br /&gt;
-- Functions returning false or nil will be treated as outputting the empty&lt;br /&gt;
-- string &amp;quot;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
local params = {}&lt;br /&gt;
&lt;br /&gt;
-- Renders any errors that were found when processing the input.&lt;br /&gt;
function params.INPUT_ERRORS(data)&lt;br /&gt;
	local nErrors = #data.errors&lt;br /&gt;
	if nErrors &amp;gt; 1 then&lt;br /&gt;
		return &amp;#039;\n* &amp;#039; .. table.concat(data.errors, &amp;#039;\n* &amp;#039;)&lt;br /&gt;
	elseif nErrors == 1 then&lt;br /&gt;
		return &amp;#039;\n&amp;#039; .. data.errors[1]&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- The current month and year, e.g. &amp;quot;March 2015&amp;quot;.&lt;br /&gt;
function params.MONTH_AND_YEAR()&lt;br /&gt;
	return lang:formatDate(&amp;#039;F Y&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- The contents of the heading.&lt;br /&gt;
function params.HEADING(data)&lt;br /&gt;
	return table.concat(data.articles, &amp;#039;, &amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- The current subpage name.&lt;br /&gt;
function params.NOM_SUBPAGE(data)&lt;br /&gt;
	return data.title.subpageText&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Other arguments for the nompage link template, separated by pipes.&lt;br /&gt;
function params.NOMPAGE_LINK_ARGS(data)&lt;br /&gt;
	local vals = normalizeTemplateParameters(data.articles)&lt;br /&gt;
	return table.concat(vals, &amp;#039;|&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- A comment.&lt;br /&gt;
function params.COMMENT(data)&lt;br /&gt;
	if data.args.comment then&lt;br /&gt;
		return &amp;quot;\n:* &amp;#039;&amp;#039;Comment&amp;#039;&amp;#039;: &amp;quot; .. data.args.comment&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- The status of the article when it was nominated.&lt;br /&gt;
function params.STATUS(data)&lt;br /&gt;
	local status = data.args.status&lt;br /&gt;
	status = status and status:lower()&lt;br /&gt;
&lt;br /&gt;
	-- C&lt;br /&gt;
	if status == &amp;#039;C&amp;#039; then&lt;br /&gt;
		return &amp;#039;C-class&amp;#039;&lt;br /&gt;
	-- B&lt;br /&gt;
	elseif status == &amp;#039;B&amp;#039; then&lt;br /&gt;
		return &amp;#039;B-class&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	-- Improved to GA&lt;br /&gt;
	elseif status == &amp;#039;ga&amp;#039; then&lt;br /&gt;
		return &amp;#039;Good Article&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	-- Default&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;#039;unknown&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
end	&lt;br /&gt;
&lt;br /&gt;
-- A list of the authors, with user and user talk links.&lt;br /&gt;
function params.AUTHORS(data)&lt;br /&gt;
	local authors = getNormalisedAuthors(data)&lt;br /&gt;
	for i, author in ipairs(authors) do&lt;br /&gt;
		authors[i] = makeUserLinks(author)&lt;br /&gt;
	end&lt;br /&gt;
	local separator = &amp;#039;, &amp;#039;&lt;br /&gt;
	local conjunction&lt;br /&gt;
	if #authors &amp;gt; 2 then&lt;br /&gt;
		conjunction = &amp;#039;, and &amp;#039;&lt;br /&gt;
	else&lt;br /&gt;
		conjunction = &amp;#039; and &amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	return mw.text.listToText(authors, separator, conjunction)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Blurb for who the article was nominated by.&lt;br /&gt;
function params.NOMINATED(data)&lt;br /&gt;
	local authors = data.authors&lt;br /&gt;
	if #authors &amp;gt; 1 or authors[1] and authors[1] ~= data.revisionUser then&lt;br /&gt;
		return &amp;#039;Nominated by &amp;#039; .. makeUserLinks(data.revisionUser)&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;#039;Self-nominated&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Exports&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p._main(args, frame, title)&lt;br /&gt;
	-- Subst check.&lt;br /&gt;
	-- Check for the frame object as well to make debugging easier from the&lt;br /&gt;
	-- debug console.&lt;br /&gt;
	if frame and not mw.isSubsting() then&lt;br /&gt;
		return &amp;#039;&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;&amp;#039; ..&lt;br /&gt;
			&amp;#039;This template must be [[Wikipedia:Substitution|substituted]]. &amp;#039; ..&lt;br /&gt;
			&amp;#039;Replace &amp;lt;code&amp;gt;{{VENAClassnomination}}&amp;lt;/code&amp;gt; with &amp;#039; ..&lt;br /&gt;
			&amp;#039;&amp;lt;code&amp;gt;{{subst:VENAClassnomination}}&amp;lt;/code&amp;gt;.&amp;lt;/strong&amp;gt;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Set default arguments.&lt;br /&gt;
	frame = frame or mw.getCurrentFrame()&lt;br /&gt;
	title = title or mw.title.getCurrentTitle()&lt;br /&gt;
&lt;br /&gt;
	-- Process data from the arguments.&lt;br /&gt;
	local splitArgs = splitByPrefix(args)&lt;br /&gt;
	local articles = getPrefixedArgs(args, splitArgs, {&amp;#039;article&amp;#039;})&lt;br /&gt;
	local authors = getPrefixedArgs(&lt;br /&gt;
		args,&lt;br /&gt;
		splitArgs,&lt;br /&gt;
		{&amp;#039;expander&amp;#039;, &amp;#039;creator&amp;#039;, &amp;#039;writer&amp;#039;, &amp;#039;author&amp;#039;}&lt;br /&gt;
	)&lt;br /&gt;
	local alts = getPrefixedArgs(args, splitArgs, {&amp;#039;ALT&amp;#039;})&lt;br /&gt;
&lt;br /&gt;
	-- Input sanity checks.&lt;br /&gt;
	local errors = {}&lt;br /&gt;
	for i, article in ipairs(articles) do&lt;br /&gt;
		local articleTitle = mw.title.new(article)&lt;br /&gt;
		if not articleTitle then&lt;br /&gt;
			table.insert(errors, formatInvalidTitleError(&lt;br /&gt;
				article,&lt;br /&gt;
				&amp;#039;article name&amp;#039;&lt;br /&gt;
			))&lt;br /&gt;
			articles[i] = &amp;#039;&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if #articles &amp;lt; 1 then&lt;br /&gt;
		articles[1] = title.subpageText&lt;br /&gt;
	end&lt;br /&gt;
	for i, author in ipairs(authors) do&lt;br /&gt;
		authors[i] = getRootPageText(author)&lt;br /&gt;
		if not authors[i] then&lt;br /&gt;
			table.insert(errors, formatInvalidTitleError(author, &amp;#039;user name&amp;#039;))&lt;br /&gt;
			authors[i] = &amp;#039;&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Substitute the parameters in the output template.&lt;br /&gt;
	local data = {&lt;br /&gt;
		errors = errors,&lt;br /&gt;
		args = args,&lt;br /&gt;
		articles = articles,&lt;br /&gt;
		authors = authors,&lt;br /&gt;
		revisionUser = frame:preprocess(&amp;#039;{{safesubst:REVISIONUSER}}&amp;#039;),&lt;br /&gt;
		alts = alts,&lt;br /&gt;
		title = title,&lt;br /&gt;
	}&lt;br /&gt;
	local ret = OUTPUT_TEMPLATE:gsub(&amp;#039;${([%u_]+)}&amp;#039;, function (funcName)&lt;br /&gt;
		local func = params[funcName]&lt;br /&gt;
		if not func then&lt;br /&gt;
			error(string.format(&lt;br /&gt;
				&amp;quot;invalid parameter &amp;#039;${%s}&amp;#039; &amp;quot; ..&lt;br /&gt;
				&amp;quot;(no corresponding parameter function found)&amp;quot;,&lt;br /&gt;
				funcName&lt;br /&gt;
			))&lt;br /&gt;
		end&lt;br /&gt;
		return func(data) or &amp;#039;&amp;#039;&lt;br /&gt;
	end)&lt;br /&gt;
	return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local args = require(&amp;#039;Module:Arguments&amp;#039;).getArgs(frame, {&lt;br /&gt;
		wrappers = &amp;#039;Template:VENAClassnomination&amp;#039;&lt;br /&gt;
	})&lt;br /&gt;
	return p._main(args, frame)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Kingsif</name></author>
	</entry>
</feed>