Jump to content

Module:Signpost

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mr. Stradivarius (talk | contribs) at 15:13, 1 March 2015 (create simple module to get lists of Signpost articles - will probably change significantly). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local data = mw.loadData('Module:Signpost/data')

local p = {}

function p._tag(tag)
	if not tag then
		return nil
	end
	local articles = data.tags[tag]
	if not articles then
		return nil
	end
	local ret = {}
	ret[#ret + 1] = '<ul>'
	for i, t in ipairs(articles) do
		ret[#ret + 1] = string.format(
			'<li>%s, %s: [[%s|%s]]</li>',
			t.date, t.shortTitle, t.page, t.longTitle
		)
	end
	ret[#ret + 1] = '</ul>'
	return table.concat(ret, '\n')
end

function p.tag(frame)
	local tag = frame.args[1]
	return p._tag(tag)
end

return p