Content deleted Content added
this should fix it for all namespaces, see talk page |
various fixes tested in sandbox, see Template talk:Archive for details |
||
Line 4:
-- 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 {{
-------------------------------------------------------------------------------
Line 27 ⟶ 26:
return s
end
local function makeTable(width)
local archiveTable = mw.html.create('table')
archiveTable
:css({
['max-width'] = width,
})▼
-- Set width so that the table doesn't spill out on narrower skins
-- or when zooming in. It has to be defined multiple times because
-- "stretch" is experimental.
:cssText('width:100%;width:-moz-available;width:-webkit-fill-available;width:stretch')
return archiveTable
-------------------------------------------------------------------------------
Line 94 ⟶ 109:
end
local namespace = 'main'
if current.isTalkPage == true then
namespace = 'talk'
end
local subjectPage = current.subjectNsText .. ':' .. current.rootText
-- Prepend colon for non-mainspace pages.
if current.subjectNsText ~= '' then
subjectPage = ':' .. subjectPage
end
if args.period then
ret = self:message('blurb-period', talkPage, makeWikilink(subjectPage),
Line 236 ⟶ 251:
if args.next then archives[#archives + 1] = mw.title.new(args.next) end
local
▲ 'margin:0 auto 0.5em;text-align:center"'
▲ }
for i, title in ipairs(archives) do
if tostring(title) == self.currentTitle.prefixedText then
'<span style="font-size:115%%;">%s</span>',
makeWikilink(title.fullText, title.subpageText)
))
else
table:tag("td"):wikitext(
)
end
end
▲ return table.concat(links)
end
if noLinks < 1 then
Line 297 ⟶ 309:
-- Output the wikitable.
local width
if noLinks <= 3 then
Line 304 ⟶ 315:
width = string.format('%dem', (noLinks + 3) * 5)
else
width = '
end
local table = makeTable(width)
▲ 'margin:0 auto 0.5em;text-align:center"',
)▼
for i, s in ipairs(links) do
table:tag("td"):wikitext(s)
if i % 20 == 1 then▼
▲ end
end
return
end
function Navigator:__tostring()
local args = self.args
local boxComponents
local archiveBox = self:makeArchiveLinksWikitable() .. ▼
' __NONEWSECTIONLINK__ __NOEDITSECTION__ __ARCHIVEDTALK__'▼
-- Is |omit filled? If not, make the whole box.
if args[1] ~= '1' and args.omit ~= 'banner' then ▼
-- We're omitting the banner, so we should only make the links table.
▲ archiveBox = self:makeMessageBox() .. '\n' .. archiveBox
-- We're omitting the archives, so we should only make the banner.
elseif args.omit == 'archives' then
boxComponents = self:makeMessageBox()
end
return boxComponents
end
|