Module:Uses TemplateStyles:修订间差异

Lhscogs​(留言 | 贡献)
小 导入1个版本
Lhscogs​(留言 | 贡献)
小 导入1个版本
 
(未显示另一用户的1个中间版本)
第4行: 第4行:
local mTableTools = require('Module:TableTools')
local mTableTools = require('Module:TableTools')
local mMessageBox = require('Module:Message box')
local mMessageBox = require('Module:Message box')
local TrackingCategory = require('Module:TrackingCategory')


local p = {}
local p = {}
第27行: 第28行:
local tStyles = mTableTools.compressSparseArray(args)
local tStyles = mTableTools.compressSparseArray(args)
local box = p.renderBox(tStyles)
local box = p.renderBox(tStyles)
local trackingCategories = p.renderTrackingCategories(args, tStyles)
p.renderTrackingCategories(args, tStyles)
return box .. trackingCategories
return box
end
end


第90行: 第91行:
for i, ts in ipairs(tStyles) do
for i, ts in ipairs(tStyles) do
local tsTitleObj = mw.title.new(ts)
local tsTitleObj = mw.title.new(ts)
local tsProt = tsTitleObj.protectionLevels["edit"] and tsTitleObj.protectionLevels["edit"][1] or nil
if (tsTitleObj or {}).protectionLevels then --能夠讀取保護狀態的標題
if tsProt ~= currentProt then
local tsProt = tsTitleObj.protectionLevels["edit"] and tsTitleObj.protectionLevels["edit"][1] or nil
cats[#cats + 1] = "使用模板样式并受保护的模板"
if tsProt ~= currentProt then
break
cats[#cats + 1] = "使用模板样式并受保护的模板"
break
end
end
end
end
end
end
end
local frame = mw.getCurrentFrame()
for i, cat in ipairs(cats) do
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
TrackingCategory.append(frame,cat)
end
end
return table.concat(cats)
end
end


return p
return p