Modul:Protection banner: Unterschied zwischen den Versionen

add category sort keys
K (fix cfg field name)
(add category sort keys)
Zeile 16: Zeile 16:
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------


local function makeCategoryLink(cat)
local function makeCategoryLink(cat, sort)
if cat then
local nsText = mw.site.namespaces[14].name
if cat and sort then
return string.format(
'[[%s:%s|%s]]',
nsText,
cat,
sort
)
elseif cat then
return string.format(
return string.format(
'[[%s:%s]]',
'[[%s:%s]]',
mw.site.namespaces[14].name,
nsText,
cat
cat
)
)
Zeile 293: Zeile 301:
local attempt = cats[key]
local attempt = cats[key]
if attempt then
if attempt then
return makeCategoryLink(attempt)
return makeCategoryLink(attempt, title.text)
end
end
end
end
Zeile 330: Zeile 338:
local ret = { self:makeProtectionCategory() }
local ret = { self:makeProtectionCategory() }
if self:needsExpiry() then
if self:needsExpiry() then
ret[#ret + 1] = makeCategoryLink(msg['tracking-category-expiry'])
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-expiry'],
self.title.text
)
end
end
if self:isIncorrect() then
if self:isIncorrect() then
ret[#ret + 1] = makeCategoryLink(msg['tracking-category-incorrect'])
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-incorrect'],
self.title.text
)
end
end
if self:isTemplateProtectedNonTemplate() then
if self:isTemplateProtectedNonTemplate() then
ret[#ret + 1] = makeCategoryLink(msg['tracking-category-template'])
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-template'],
self.title.text
)
end
end
return table.concat(ret)
return table.concat(ret)
Zeile 817: Zeile 834:
'<strong class="error">%s</strong>%s',
'<strong class="error">%s</strong>%s',
errorText,
errorText,
makeCategoryLink(cfg.msg['tracking-category-incorrect'])
makeCategoryLink(
cfg.msg['tracking-category-incorrect'],
title and title.text or mw.title.getCurrentTitle().text
)
)
)
end
end
Anonymer Benutzer