Module:Article history

This is an old revision of this page, as edited by Mr. Stradivarius (talk | contribs) at 07:08, 14 October 2014 (add some more details of things to implement, and add a helper function). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

-------------------------------------------------------------------------------
--                            Article history
--
-- This module allows editors to link to all the significant events in an
-- article's history, such as good article nominations and featured article
-- nominations. It also displays its current status or statuses, as well as
-- other information such as the date it was featured on the main page.
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
-- Helper functions
-------------------------------------------------------------------------------

local function isPositiveInteger(num)
	return type(num) == 'number'
		and math.floor(num) == num
		and num > 0
		and num < math.huge
end

-------------------------------------------------------------------------------
-- Action class
-- Action objects deal with a single action in the history of the article.
-------------------------------------------------------------------------------

local Action = {}
Action.__index = Action

-- Properties to implement:
-- * title
-- * oldid
-- * paramNum

function Action:getResult()
end

function Action:getCurrentStatus()
end

-------------------------------------------------------------------------------
-- ImageRow
-- ImageRow objects represent a row with its own image and blurb.
-------------------------------------------------------------------------------

local ImageRow = {}
ImageRow.__index = ImageRow

-------------------------------------------------------------------------------
-- Status class
-- Status objects deal with possible current statuses of the article. Articles
-- can have more than one current status; for example, an article can be both a
-- good article and a former featured article.
-------------------------------------------------------------------------------

local Status = {}
Status.__index = Status

-------------------------------------------------------------------------------
-- Notice class
-- Notice objects contain notices about an article that aren't time-dependent
-- and aren't part of its current status, e.g. the topic area of a good
-- article, or the date the article was featured on DYK.
-------------------------------------------------------------------------------

local Notice = {}
Notice.__index = Notice

-------------------------------------------------------------------------------
-- ArticleHistory class
-- This class represents the whole template.
-------------------------------------------------------------------------------

local ArticleHistory = {}
ArticleHistory.__index = ArticleHistory

-------------------------------------------------------------------------------
-- Exports
-- These functions are called from Lua and from wikitext.
-------------------------------------------------------------------------------

local p = {}

function p._main(args)
end

function p.main(frame)
	local args = require('Module:Arguments').getArgs(frame, {
		wrappers = 'Template:Article history'
	})
	return p._main(args)
end

function p._exportClasses()
	return {
		Action = Action,
		ImageRow = ImageRow,
		Status = Status,
		Notice = Notice,
		ArticleHistory = ArticleHistory
	}
end

return p