Difference between revisions of "Module:Automatic archive navigator/sandbox"

From blackwiki
Jump to navigation Jump to search
blackwiki>Mr. Stradivarius
(add blurb-making methods)
m (52 revisions imported)
 
(34 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
-------------------------------------------------------------------------------
 +
--                      Automatic archive navigator
 
--
 
--
-- This module implements {{Automatic archive navigator}}
+
-- This module produces a talk archive banner, together with an automatically-
--
+
-- generated list of navigation links to other archives of the talk page in
 
+
-- question. It implements {{Automatic archive navigator}} and
require('Module:No globals')
+
-- {{Talk archive navigation}}.
local checkType = require('libraryUtil').checkType
 
 
 
-------------------------------------------------------------------------------
 
-- Config
 
 
-------------------------------------------------------------------------------
 
-------------------------------------------------------------------------------
  
local cfg = {
+
local yesno = require('Module:Yesno')
['blurb-period'] = "This is an '''[[Help:Archiving a talk page|archive]]''' " ..
 
"of past discussions for the period '''$2'''. '''Do not edit the " ..
 
"contents of this page.''' If you wish to start a new discussion or " ..
 
"revive an old one, please do so on the $1.",
 
['blurb-noperiod'] = "This is an '''[[Help:Archiving a talk page|archive]]''' " ..
 
"of past discussions. '''Do not edit the contents of this page.''' If " ..
 
"you wish to start a new discussion or revive an old one, please do so " ..
 
"on the $1.",
 
['blurb-talk-link-display'] = 'current talk page',
 
['default-icon'] = 'Replacement filing cabinet.svg',
 
['image-size'] = '40x40px'
 
}
 
  
 
-------------------------------------------------------------------------------
 
-------------------------------------------------------------------------------
Line 29: Line 15:
  
 
local function makeWikilink(page, display)
 
local function makeWikilink(page, display)
return string.format('[[%s|%s]]', page, display)
+
if display then
end
+
return string.format('[[%s|%s]]', page, display)
 
+
else
-------------------------------------------------------------------------------
+
return string.format('[[%s]]', page)
-- Archive class
+
end
-------------------------------------------------------------------------------
 
 
 
local Archive = {}
 
Archive.__index = Archive
 
 
 
function Archive.new(basePageName, prefix, num)
 
checkType('Archive.new', 1, num, 'number')
 
local obj = setmetatable({}, Archive)
 
obj.basePageName = basePageName
 
obj.prefix = prefix
 
obj.num = num
 
return obj
 
 
end
 
end
  
function Archive:makeLink(current)
+
local function escapePattern(s)
local subpage = self.prefix .. tostring(self.num)
+
-- Escape punctuation in a string so it can be used in a Lua pattern.
local page = self.basePageName .. subpage
+
s = s:gsub('%p', '%%%0')
local link = makeWikilink(page, subpage)
+
return s
if current and self.num == current then
 
link = string.format('<span style="font-size:115%;">%s</span>', link)
 
end
 
return link
 
 
end
 
end
  
Line 66: Line 36:
  
 
function Navigator.new(args, cfg, currentTitle)
 
function Navigator.new(args, cfg, currentTitle)
local obj = {}
+
local obj = setmetatable({}, Navigator)
setmetatable(obj, Navigator)
 
 
 
-- Set inputs.
+
-- Set inputs
 
obj.args = args
 
obj.args = args
 
obj.cfg = cfg
 
obj.cfg = cfg
 
obj.currentTitle = currentTitle
 
obj.currentTitle = currentTitle
  
-- Define object structure.
+
-- Archive prefix
obj.links = {}
+
-- Decode HTML entities so users can enter things like "Archive&#32;" from
 +
-- wikitext.
 +
obj.archivePrefix = obj.args.prefix or obj:message('archive-prefix')
 +
obj.archivePrefix = mw.text.decode(obj.archivePrefix)
 +
 
 +
-- Current archive number
 +
do
 +
local pattern = string.format(
 +
'^%s([1-9][0-9]*)$',
 +
escapePattern(obj.archivePrefix)
 +
)
 +
obj.currentArchiveNum = obj.currentTitle.subpageText:match(pattern)
 +
obj.currentArchiveNum = tonumber(obj.currentArchiveNum)
 +
end
 +
 +
-- Highest archive number
 +
obj.highestArchiveNum = require('Module:Highest archive number')._main(
 +
obj.currentTitle.nsText ..
 +
':' ..
 +
obj.currentTitle.baseText ..
 +
'/' ..
 +
obj.archivePrefix
 +
)
  
 
return obj
 
return obj
Line 95: Line 86:
 
return ''
 
return ''
 
else
 
else
local ret = '----\n'
+
local ret
 
if args.text then
 
if args.text then
ret = ret .. args.text
+
ret = args.text
 
else
 
else
local basePage = self.currentTitle.basePageTitle.prefixedText
+
local talkPage = self.currentTitle.nsText ..
local talkLink = makeWikilink(
+
':' ..
basePage,
+
self.currentTitle.baseText
self:message('blurb-talk-link-display')
+
if args.period then
)
+
ret = self:message('blurb-period', talkPage, args.period)
local key = args.period and 'blurb-period' or 'blurb-noperiod'
+
else
ret = ret .. self:message(key, talkLink, args.period or '')
+
ret = self:message('blurb-noperiod', talkPage)
 +
end
 
end
 
end
 
return ret
 
return ret
Line 137: Line 129:
 
end
 
end
  
function Navigator:makeLinksWikitable()
+
function Navigator:getArchiveNums()
-- Makes a single-row wikitable from an array of links
+
-- Returns an array of the archive numbers to format.
local ret = {}
+
local noLinks = tonumber(self.args.links) or self:message('default-link-count')
ret[#ret + 1] = '{| style="width: 32em; background: transparent; margin: 0 auto 0.5em; text-align: center"'
+
noLinks = math.floor(noLinks)
for _, link in ipairs(self.links) do
+
-- If |noredlinks is "yes", true or absent, don't allow red links. If it is
ret[#ret + 1] = '\n| '
+
-- 'no' or false, allow red links.
ret[#ret + 1] = link
+
local allowRedLinks = yesno(self.args.noredlinks) == false
 +
 +
local current = self.currentArchiveNum
 +
local highest = self.highestArchiveNum
 +
 
 +
if not current or not highest or noLinks < 1 then
 +
return {}
 +
elseif noLinks == 1 then
 +
return {current}
 
end
 
end
ret[#ret + 1] = '\n|}'
 
return table.concat(ret)
 
end
 
  
-------------------------------------------------------------------------------
+
local function getNum(i, current)
-- Exports
+
-- Gets an archive number given i, the position in the array away from
-------------------------------------------------------------------------------
+
-- the current archive, and the current archive number. The first two
 +
-- offsets are consecutive; the third offset is rounded up to the
 +
-- nearest 5; and the fourth and subsequent offsets are rounded up to
 +
-- the nearest 10. The offsets are calculated in such a way that archive
 +
-- numbers will not be duplicated.
 +
if -2 <= i and i <= 2 then
 +
return current + i
 +
elseif -3 <= i and i <= 3 then
 +
return current + 2 - (current + 2) % 5 + (i / 3) * 5
 +
elseif 4 <= i then
 +
return current + 7 - (current + 7) % 10 + (i - 3) * 10
 +
else
 +
return current + 2 - (current + 2) % 10 + (i + 3) * 10
 +
end
 +
end
  
local p = {}
+
local nums = {}
  
local function getSubpageLink(offset, currentTitle)
+
-- Archive nums lower than the current page.
-- Get a formatted link to the subpage a certain distance away, or nil
+
for i = -1, -math.floor((noLinks - 1) / 2), -1 do
-- if that subpage does not exist. e.g. If the current subpage is
+
local num = getNum(i, current)
-- /Archive 27, then getSubpageLink(3, currentTitle) returns a link to Archive 30.
+
if num <= 1 then
local subpageName
+
table.insert(nums, 1, 1)
local archiveNum = currentTitle.subpageText:match('^Archive ([1-9][0-9]*)$')
+
break
archiveNum = tonumber(archiveNum)
+
else
if archiveNum then
+
table.insert(nums, 1, num)
subpageName = 'Archive ' .. (archiveNum + offset)
+
end
elseif tonumber(currentTitle.subpageText) then
 
subpageName = currentTitle.subpageText + offset
 
else
 
return nil  -- Couldn't parse out a subpage number
 
 
end
 
end
  
local subpageTitle = mw.title.new(currentTitle.baseText .. '/' .. subpageName, currentTitle.namespace)
+
-- Current page.
if subpageTitle.exists then
+
if nums[#nums] < current then
return makeWikilink('/' .. subpageName, subpageName)
+
table.insert(nums, current)
else
 
return nil
 
 
end
 
end
end
 
  
local function getArchiveNums(current, highest, noLinks, allowRedLinks)
+
-- Higher archive nums.
-- Returns an array of the archive numbers to format.
+
for i = 1, math.ceil((noLinks - 1) / 2) do
if not current or not highest then
+
local num = getNum(i, current)
return {}
+
if num <= highest then
end
+
table.insert(nums, num)
noLinks = noLinks or 7
+
elseif allowRedLinks and (i <= 2 or i <= 3 and num == nums[#nums] + 1) then
 
+
-- Only insert one red link, and only if it is consecutive.
local nums = {}
+
table.insert(nums, highest + 1)
if noLinks >= highest then
+
break
local lim
+
elseif nums[#nums] < highest then
if allowRedLinks then
+
-- Insert the highest archive number if it isn't already there.
lim = noLinks
+
table.insert(nums, highest)
 +
break
 
else
 
else
lim = highest
+
break
end
 
for i = 1, lim do
 
nums[i] = i
 
 
end
 
end
 
end
 
end
end
+
mw.logObject(nums)
  
local function foo(prefix)
+
return nums
local highestArchive = require('Module:Highest archive number')._main(prefix)
 
 
end
 
end
  
local function getLinksText(args, currentTitle)
+
function Navigator:makeArchiveLinksWikitable()
local nbsp = '&nbsp;'
+
local lang = mw.language.getContentLanguage()
local arrowSpacer, linkSpacer
+
local nums = self:getArchiveNums()
if mw.ustring.len(currentTitle.subpageText) <= 4 then
+
local current = self.currentArchiveNum
-- If page names are short, we want more space.
+
local highest = self.highestArchiveNum
arrowSpacer = nbsp:rep(5)
+
local noLinks = #nums
linkSpacer = nbsp:rep(7)
+
if noLinks < 1 then
else
+
return 'NO LINKS ' .. tostring(self.currentArchiveNum) .. ' / ' .. tostring(self.highestArchiveNum)
arrowSpacer = nbsp:rep(2)
 
linkSpacer = nbsp:rep(4)
 
 
end
 
end
  
local ret = {}
+
-- Make the table of links.
 +
local links = {}
 +
local isCompact = noLinks > 7
 +
local currentIndex
 +
for i, num in ipairs(nums) do
 +
local subpage = self.archivePrefix .. tostring(num)
 +
local display
 +
if isCompact then
 +
display = tostring(num)
 +
else
 +
display = self:message('archive-link-display', num)
 +
end
 +
local link = makeWikilink('../' .. subpage, display)
 +
if num == self.currentArchiveNum then
 +
link = string.format('<span style="font-size:115%%;">%s</span>', link)
 +
currentIndex = i
 +
end
 +
table.insert(links, link)
 +
end
  
for offset = -5, -3 do
+
-- Add the arrows.
local link = getSubpageLink(offset, currentTitle)
+
-- We must do the forwards arrow first as we are adding elements to the
if link then
+
-- links table. If we did the backwards arrow first the index for the
if offset == -3 then
+
-- current archive would be wrong.
ret[#ret + 1] = link
+
currentIndex = currentIndex or math.ceil(#links / 2)
ret[#ret + 1] = linkSpacer
+
for i = currentIndex + 1, #links do
else
+
if nums[i] - nums[i - 1] > 1 then
ret[#ret + 1] = link
+
table.insert(links, i, lang:getArrow('forwards'))
ret[#ret + 1] = ' ←'
 
ret[#ret + 1] = arrowSpacer
 
end
 
 
break
 
break
 
end
 
end
 
end
 
end
 
+
for i = currentIndex - 1, 1, -1 do
for offset = -2, -1 do
+
if nums[i + 1] - nums[i] > 1 then
local link = getSubpageLink(offset, currentTitle)
+
table.insert(links, i + 1, lang:getArrow('backwards'))
if link then
+
break
ret[#ret + 1] = link
 
ret[#ret + 1] = linkSpacer
 
 
end
 
end
 
end
 
end
  
ret[#ret + 1] = '<span style="font-size:115%;">'
+
-- Output the wikitable.
ret[#ret + 1] = makeWikilink(currentTitle.prefixedText, currentTitle.subpageText)
+
local ret = {}
ret[#ret + 1] = '</span>'
+
local width
 
+
if noLinks <= 3 then
for offset = 1, 2 do
+
width = string.format('%dem', noLinks * 10)
local link = getSubpageLink(offset, currentTitle)
+
elseif noLinks <= 7 then
if link then
+
width = string.format('%dem', (noLinks + 3) * 5)
ret[#ret + 1] = linkSpacer
+
else
ret[#ret + 1] = link
+
width = '50em'
end
 
 
end
 
end
 
+
ret[#ret + 1] = string.format(
for offset = 5, 3, -1 do
+
'{| style="width:%s;background:transparent;' ..
local link = getSubpageLink(offset, currentTitle)
+
'margin:0 auto 0.5em;text-align:center"',
if link then
+
width
if offset == 3 then
+
)
ret[#ret + 1] = linkSpacer
+
for i, s in ipairs(links) do
ret[#ret + 1] = link
+
if i % 20 == 1 then
else
+
ret[#ret + 1] = '\n|-'
ret[#ret + 1] = arrowSpacer
 
ret[#ret + 1] = ''
 
ret[#ret + 1] = link
 
end
 
break
 
 
end
 
end
 +
ret[#ret + 1] = '\n| '
 +
ret[#ret + 1] = s
 
end
 
end
 +
ret[#ret + 1] = '\n|}'
 +
return table.concat(ret)
 +
end
  
return table.concat(ret)
+
function Navigator:__tostring()
 +
return self:makeMessageBox() ..
 +
'\n' ..
 +
self:makeArchiveLinksWikitable() ..
 +
' __NONEWSECTIONLINK__ __NOEDITSECTION__'
 
end
 
end
  
function p._aan(args, currentTitle)
+
-------------------------------------------------------------------------------
currentTitle = currentTitle or mw.title.getCurrentTitle()
+
-- Exports
 +
-------------------------------------------------------------------------------
  
local image = args.image
+
local p = {}
if not image then
 
image = '[[File:' .. (args.icon or 'Replacement filing cabinet.svg') .. '|40x40px|alt=|link=]]'
 
end
 
  
local mbox = require('Module:Message box').main('tmbox', {
+
function p._exportClasses()
image = image,
+
return {
imageright = args.imageright,
+
Navigator = Navigator
style = args.style or 'width:80%;margin-left:auto;margin-right:auto;',
+
}
textstyle = args.textstyle or 'text-align:center;',
+
end
text = getLinksText(args, currentTitle) .. '\n' .. getMessage(args, currentTitle)
 
})
 
  
return mbox .. '__NONEWSECTIONLINK__ __NOEDITSECTION__'
+
function p._aan(args, cfg, currentTitle)
 +
cfg = cfg or mw.loadData('Module:Automatic archive navigator/config')
 +
currentTitle = currentTitle or mw.title.getCurrentTitle()
 +
local aan = Navigator.new(args, cfg, currentTitle)
 +
return tostring(aan)
 
end
 
end
  
function p._tan(args)
+
function p.aan(frame)
args.links = args.links or 3
+
local args = require('Module:Arguments').getArgs(frame, {
args.noredlinks = args.noredlinks or false
+
wrappers = 'Template:Automatic archive navigator',
 +
})
 
return p._aan(args)
 
return p._aan(args)
 
end
 
end
 
setmetatable(p, {__index = function(t, k)
 
return function(frame)
 
local args = require('Module:Arguments').getArgs(frame, {
 
wrappers = {
 
'Template:Automatic archive navigator',
 
'Template:Talk archive navigation'
 
}
 
})
 
return p['_' .. k](args)
 
end
 
end})
 
 
p.Navigator = Navigator
 
p.cfg = cfg
 
  
 
return p
 
return p

Latest revision as of 13:17, 26 September 2020

Documentation for this module may be created at Module:Automatic archive navigator/sandbox/doc

-------------------------------------------------------------------------------
--                       Automatic archive navigator
--
-- This module produces a talk archive banner, together with an automatically-
-- generated list of navigation links to other archives of the talk page in
-- question. It implements {{Automatic archive navigator}} and
-- {{Talk archive navigation}}.
-------------------------------------------------------------------------------

local yesno = require('Module:Yesno')

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

local function makeWikilink(page, display)
	if display then
		return string.format('[[%s|%s]]', page, display)
	else
		return string.format('[[%s]]', page)
	end
end

local function escapePattern(s)
	-- Escape punctuation in a string so it can be used in a Lua pattern.
	s = s:gsub('%p', '%%%0')
	return s
end

-------------------------------------------------------------------------------
-- Navigator class
-------------------------------------------------------------------------------

local Navigator = {}
Navigator.__index = Navigator

function Navigator.new(args, cfg, currentTitle)
	local obj = setmetatable({}, Navigator)
	
	-- Set inputs
	obj.args = args
	obj.cfg = cfg
	obj.currentTitle = currentTitle

	-- Archive prefix
	-- Decode HTML entities so users can enter things like "Archive&#32;" from
	-- wikitext.
	obj.archivePrefix = obj.args.prefix or obj:message('archive-prefix')
	obj.archivePrefix = mw.text.decode(obj.archivePrefix)

	-- Current archive number
	do
		local pattern = string.format(
			'^%s([1-9][0-9]*)$',
			escapePattern(obj.archivePrefix)
		)
		obj.currentArchiveNum = obj.currentTitle.subpageText:match(pattern)
		obj.currentArchiveNum = tonumber(obj.currentArchiveNum)
	end
	
	-- Highest archive number
	obj.highestArchiveNum = require('Module:Highest archive number')._main(
		 obj.currentTitle.nsText ..
		 	':' .. 
			obj.currentTitle.baseText .. 
			'/' .. 
			obj.archivePrefix
	)

	return obj
end

function Navigator:message(key, ...)
	local msg = self.cfg[key]
	if select('#', ...) > 0 then
		return mw.message.newRawMessage(msg, ...):plain()
	else
		return msg
	end
end

function Navigator:makeBlurb()
	local args = self.args
	if args[1] == '1' then
		-- The old template used "|1" to suppress the blurb.
		return ''
	else
		local ret
		if args.text then
			ret = args.text
		else
			local talkPage = self.currentTitle.nsText ..
				':' ..
				self.currentTitle.baseText
			if args.period then
				ret = self:message('blurb-period', talkPage, args.period)
			else
				ret = self:message('blurb-noperiod', talkPage)
			end
		end
		return ret
	end
end

function Navigator:makeMessageBox()
	local args = self.args
	
	local image
	if args.image then
		image = args.image
	else
		local icon = args.icon or self:message('default-icon')
		image = string.format(
			'[[File:%s|%s|alt=|link=]]',
			icon,
			self:message('image-size')
		)
	end

	local mbox = require('Module:Message box').main('tmbox', {
		image = image,
		imageright = args.imageright,
		style = args.style or 'width:80%;margin-left:auto;margin-right:auto',
		textstyle = args.textstyle or 'text-align:center',
		text = self:makeBlurb()
	})

	return mbox
end

function Navigator:getArchiveNums()
	-- Returns an array of the archive numbers to format.
	local noLinks = tonumber(self.args.links) or self:message('default-link-count')
	noLinks = math.floor(noLinks)
	-- If |noredlinks is "yes", true or absent, don't allow red links. If it is 
	-- 'no' or false, allow red links.
	local allowRedLinks = yesno(self.args.noredlinks) == false
	
	local current = self.currentArchiveNum
	local highest = self.highestArchiveNum

	if not current or not highest or noLinks < 1 then
		return {}
	elseif noLinks == 1 then
		return {current}
	end

	local function getNum(i, current)
		-- Gets an archive number given i, the position in the array away from
		-- the current archive, and the current archive number. The first two
		-- offsets are consecutive; the third offset is rounded up to the
		-- nearest 5; and the fourth and subsequent offsets are rounded up to
		-- the nearest 10. The offsets are calculated in such a way that archive
		-- numbers will not be duplicated.
		if -2 <= i and i <= 2 then
			return current + i
		elseif -3 <= i and i <= 3 then
			return current + 2 - (current + 2) % 5 + (i / 3) * 5
		elseif 4 <= i then
			return current + 7 - (current + 7) % 10 + (i - 3) * 10
		else
			return current + 2 - (current + 2) % 10 + (i + 3) * 10
		end
	end

	local nums = {}

	-- Archive nums lower than the current page.
	for i = -1, -math.floor((noLinks - 1) / 2), -1 do
		local num = getNum(i, current)
		if num <= 1 then
			table.insert(nums, 1, 1)
			break
		else
			table.insert(nums, 1, num)
		end
	end

	-- Current page.
	if nums[#nums] < current then
		table.insert(nums, current)
	end

	-- Higher archive nums.
	for i = 1, math.ceil((noLinks - 1) / 2) do
		local num = getNum(i, current)
		if num <= highest then
			table.insert(nums, num)
		elseif allowRedLinks and (i <= 2 or i <= 3 and num == nums[#nums] + 1) then
			-- Only insert one red link, and only if it is consecutive.
			table.insert(nums, highest + 1)
			break
		elseif nums[#nums] < highest then
			-- Insert the highest archive number if it isn't already there.
			table.insert(nums, highest)
			break
		else
			break
		end
	end
	mw.logObject(nums)

	return nums
end

function Navigator:makeArchiveLinksWikitable()
	local lang = mw.language.getContentLanguage()
	local nums = self:getArchiveNums()
	local current = self.currentArchiveNum
	local highest = self.highestArchiveNum
	local noLinks = #nums
	if noLinks < 1 then
		return 'NO LINKS ' .. tostring(self.currentArchiveNum) .. ' / ' .. tostring(self.highestArchiveNum)
	end

	-- Make the table of links.
	local links = {}
	local isCompact = noLinks > 7
	local currentIndex
	for i, num in ipairs(nums) do
		local subpage = self.archivePrefix .. tostring(num)
		local display
		if isCompact then
			display = tostring(num)
		else
			display = self:message('archive-link-display', num)
		end
		local link = makeWikilink('../' .. subpage, display)
		if num == self.currentArchiveNum then
			link = string.format('<span style="font-size:115%%;">%s</span>', link)
			currentIndex = i
		end
		table.insert(links, link)
	end

	-- Add the arrows.
	-- We must do the forwards arrow first as we are adding elements to the
	-- links table. If we did the backwards arrow first the index for the
	-- current archive would be wrong.
	currentIndex = currentIndex or math.ceil(#links / 2)
	for i = currentIndex + 1, #links do
		if nums[i] - nums[i - 1] > 1 then
			table.insert(links, i, lang:getArrow('forwards'))
			break
		end
	end
	for i = currentIndex - 1, 1, -1 do
		if nums[i + 1] - nums[i] > 1 then
			table.insert(links, i + 1, lang:getArrow('backwards'))
			break
		end
	end

	-- Output the wikitable.
	local ret = {}
	local width
	if noLinks <= 3 then
		width = string.format('%dem', noLinks * 10)
	elseif noLinks <= 7 then
		width = string.format('%dem', (noLinks + 3) * 5)
	else
		width = '50em'
	end
	ret[#ret + 1] = string.format(
		'{| style="width:%s;background:transparent;' ..
			'margin:0 auto 0.5em;text-align:center"',
		width
	)
	for i, s in ipairs(links) do
		if i % 20 == 1 then
			ret[#ret + 1] = '\n|-'
		end
		ret[#ret + 1] = '\n| '
		ret[#ret + 1] = s
	end
	ret[#ret + 1] = '\n|}'
	return table.concat(ret)
end

function Navigator:__tostring()
	return self:makeMessageBox() ..
		'\n' .. 
		self:makeArchiveLinksWikitable() .. 
		' __NONEWSECTIONLINK__ __NOEDITSECTION__'
end

-------------------------------------------------------------------------------
-- Exports
-------------------------------------------------------------------------------

local p = {}

function p._exportClasses()
	return {
		Navigator = Navigator
	}
end

function p._aan(args, cfg, currentTitle)
	cfg = cfg or mw.loadData('Module:Automatic archive navigator/config')
	currentTitle = currentTitle or mw.title.getCurrentTitle()
	local aan = Navigator.new(args, cfg, currentTitle)
	return tostring(aan)
end

function p.aan(frame)
	local args = require('Module:Arguments').getArgs(frame, {
		wrappers = 'Template:Automatic archive navigator',
	})
	return p._aan(args)
end

return p