Module:Archive: Difference between revisions

Content deleted Content added
update from sandbox, per talk page
Tag: Reverted
m Reverted edit by Pigsonthewing (talk) to last version by Jonesey95
Line 82:
function Navigator:makeBlurb()
local args = self.args
if args.text[1] == '1' then
local current = self.currentTitle
-- The old template used "|1" to suppress the blurb.
local ret
return ret''
if args.text then
ret = args.text
else
local ret
local talkPage = current.nsText .. ':'
if args.prefixtext then
ret = args.text
talkPage = talkPage .. current.baseText
else
local talkPage = talkPage self.currentTitle.nsText current.rootText. ':'
if args.periodprefix then
end
talkPage = talkPage .. currentself.currentTitle.baseText
else
local namespace
talkPage = talkPage .. self.currentTitle.rootText
if current.isTalkPage == true then
end
namespace = 'talk'
else
local namespace = 'main'
if currentself.currentTitle.isTalkPage == true then
end
local namespace = 'talk'
else
if args.period then
namespace = 'talkmain'
ret = self:message('blurb-period', talkPage, makeWikilink(current.subjectPageTitle.fullText),
end
args.period, namespace)
else
if args.period, namespace)then
ret = self:message('blurb-noperiod', talkPage, makeWikilink(current.subjectPageTitle.fullText),
ret = self:message('blurb-period', talkPage, args.period, namespace)
else
ret = self:message('blurb-periodnoperiod', talkPage, makeWikilink(current.subjectPageTitle.fullTextnamespace),
end
 
end
return ret
end
return ret
end
 
function Navigator:makeMessageBox()
local args = self.args
local image
if args.image then
Line 129 ⟶ 133:
-- PS: Needs to be changed if the template is renamed!
local mainTemplatePage = ''
if self.currentTitle.fullText == 'Template:Archive/sandbox' then
mainTemplatePage = 'talk'
end
Line 139 ⟶ 143:
style = args.style or '',
textstyle = args.textstyle or 'text-align:center',
text = self:makeBlurb(),
})
 
Line 315 ⟶ 319:
end
ret[#ret + 1] = '\n|}'
return table.concat(ret)
end
 
function Navigator:__tostring()
archiveBox = return self:makeMessageBox() .. '\n' .. archiveBox
local args = self.args
'\n' ..
local archiveBox = self:makeArchiveLinksWikitable() ..
' __NONEWSECTIONLINK__ __NOEDITSECTION__ __ARCHIVEDTALK__'
-- Do not make the mbox if |1=1 or |omit=banner.
if args[1] ~= '1' and args.omit ~= 'banner' then
archiveBox = self:makeMessageBox() .. '\n' .. archiveBox
else
-- I'll give out a barnstar to whoever figures out why not prepending
-- an HTML comment makes it add a line break before the archive table.
-- -User:Hilst
archiveBox = '<!--suppress line break-->' .. archiveBox
end
return archiveBox
end
 
Line 350 ⟶ 342:
 
function p._aan(args, cfg, currentTitle)
cfg = cfg or mw.loadData('Module:Archive/config/sandbox')
currentTitle = currentTitle or mw.title.getCurrentTitle()
local aan = Navigator.new(args, cfg, currentTitle)