Jump to content

Module:Good article topics

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mr. Stradivarius (talk | contribs) at 07:56, 19 February 2014 (add default value for the topic variable). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

-- This module implements {{GA/Topic}}.

local p = {}

function p.main(frame)
	local topic = frame:getParent().args[1] or ''
	topic = topic:match('^%s*(.-)%s*$') -- Trim whitespace
	local ret
	if topic ~= '' then
		ret = p._main(topic)
	end
	ret = ret or ''
	return ret
end

function p._main(topic)
	topic = topic:lower()
	local data = mw.loadData('Module:Good article topics/data')
	return data[topic]
end

return p