變更

增加 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
匿名使用者