Fandom

Harry Potter Wiki

Module:Archive

14,589pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

--- This module generates a list of Archive subpages.
-- 
-- This uses expensive parser functions (#ifexist).
-- Note that there can be no gaps (eg. "Archive 3" exists, but "Archive 2" doesn't) or it won't work
local p = {}
 
function p.list(frame)
	local args = frame:getParent().args
	local pageName = mw.title.getCurrentTitle().fullText
 
	-- Auto-find archives
	local i = 1
	local exists
	local ret = {}
	repeat
		local t = mw.title.new( pageName .. '/Archive_' .. i )
		exists = t.exists
		if exists then
			ret[#ret+1] = '[[' .. t.fullText .. '|Archive ' .. i .. ']]<br/>'
			i = i + 1
		end
	until not exists
 
	-- Manual Name provided
	i = 1
	while args[i] do
		ret[#ret+1] = '[[' .. pageName..'/'..args[i] .. '|'..args[i]..']]<br/>'
		i = i + 1
	end
 
	return table.concat(ret, ' ')
end
 
return p
--[[Category:Lua Modules]]

Also on Fandom

Random Wiki