更改

添加17字节 、 2020年8月13日 (四) 19:49
无编辑摘要
第30行: 第30行:  
function p._main(frame, args)
 
function p._main(frame, args)
 
local modules = mTableTools.compressSparseArray(args)
 
local modules = mTableTools.compressSparseArray(args)
local box = p.renderBox(frame, modules)
+
local box = p.renderBox(modules)
 
local trackingCategories = p.renderTrackingCategories(args, modules)
 
local trackingCategories = p.renderTrackingCategories(args, modules)
 
return box .. trackingCategories
 
return box .. trackingCategories
第45行: 第45行:  
end
 
end
 
local modules = mTableTools.compressSparseArray(args)
 
local modules = mTableTools.compressSparseArray(args)
return p.renderBox(frame, modules)
+
return p.renderBox(modules)
 
end
 
end
 
--end
 
--end
   −
function p.renderBox(frame, modules)
+
function p.renderBox(modules)
 
local boxArgs = {}
 
local boxArgs = {}
 
if #modules < 1 then
 
if #modules < 1 then
第57行: 第57行:  
for i, module in ipairs(modules) do
 
for i, module in ipairs(modules) do
 
moduleLinks[i] = string.format('%s', module)
 
moduleLinks[i] = string.format('%s', module)
moduleLinks[i] = '[[:Module:' ..frame:callParserFunction{name = "PAGENAME", args = moduleLinks[i]} .. ']]'
+
moduleLinks[i] = '[[:Module:' .. mw.title.new(moduleLinks[i]).text .. ']]'
 
end
 
end
 
local moduleList = mList.makeList('bulleted', moduleLinks)
 
local moduleList = mList.makeList('bulleted', moduleLinks)
第115行: 第115行:  
if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end
 
if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end
 
for i, module in ipairs(modules) do
 
for i, module in ipairs(modules) do
local moduleProt = mw.title.new(module).protectionLevels["edit"][1]
+
if mw.title.new(module).protectionLevels["edit"] then
if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end
+
local moduleProt = mw.title.new(module).protectionLevels["edit"][1]
if moduleProt < currentProt then
+
if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end
cats[#cats + 1] = "使用受保护Lua模块的模板"
+
if moduleProt < currentProt then
break
+
cats[#cats + 1] = "使用受保护Lua模块的模板"
 +
break
 +
end
 
end
 
end
 
end
 
end
匿名用户