FANDOM


local mFor = require('Module:For')
local mArguments = require('Module:Arguments')
local p = {}
 
function p.forTimeline (frame)
	local args = mArguments.getArgs(frame)
	local target
	if args[1] then
		target = args[1]
	else
		local title = mw.title.getCurrentTitle().text
		local titles = {
			mw.ustring.lower(mw.ustring.sub(title, 1, 1)) .. mw.ustring.sub(title, 2),
			title
		}
		local timelineForms = {
			'Timeline of %s',
			'Timeline of %ss',
			'Timeline of the %s'
		}
		for k, v in pairs(timelineForms) do
			for i, j in pairs(titles) do
				local lookup = string.format(v, j)
				if mw.title.new(lookup, 0).exists then
					target = lookup
					break
				end
			end
			if target then break end
		end
		target = target or string.format(timelineForms[1], title)
	end
 
	return mFor._For({'a chronological guide to this subject', target})
end
 
return p

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.