Modul:Uses TemplateStyles: Unterschied zwischen den Versionen
Fixing logic
(Adding category for pages using CSS without protection template) |
(Fixing logic) |
||
| Zeile 82: | Zeile 82: | ||
end | end | ||
cats[#cats + 1] = category | cats[#cats + 1] = category | ||
if yesno(args.noprotcat) then | if not yesno(args.noprotcat) then | ||
local currentProt = titleObj.protectionLevels["edit"] and titleObj.protectionLevels["edit"][1] or nil | |||
local addedLevelCat = false | |||
local addedPadlockCat = false | |||
for i, ts in ipairs(tStyles) do | |||
local tsTitleObj = mw.title.new(ts) | |||
local tsProt = tsTitleObj.protectionLevels["edit"] and tsTitleObj.protectionLevels["edit"][1] or nil | |||
if tsProt ~= currentProt and not addedLevelCat then | |||
cats[#cats + 1] = "Templates using TemplateStyles with a different protection level" | |||
end | |||
if tsProt and not addedPadlockCat then | |||
local content = tsTitleObj:getContent() | |||
if not content:find("{{pp-") then | |||
cats[#cats + 1] = "Templates using TemplateStyles without padlocks" | |||
addedPadlockCat = true | |||
end | |||
end | end | ||
end | end | ||
end | end | ||
end | end | ||
for i, cat in ipairs(cats) do | for i, cat in ipairs(cats) do | ||
cats[i] = string.format('[[Category:%s]]', cat) | cats[i] = string.format('[[Category:%s]]', cat) | ||