求真百科歡迎當事人提供第一手真實資料,洗刷冤屈,終結網路霸凌。

變更

前往: 導覽搜尋

模块:Lua banner

移除 676 位元組, 5 年前
导入1个版本
-- This module implements the 本模組嵌入模板{{lua}} template.
local yesno = require('Module:Yesno')
local mList = require('Module:List')
local mTableTools = require('Module:TableTools')
local mMessageBox = require('Module:Message box')
local p = {}
function p.main(frame)
local origArgs = frame:getParent().args
return p._main(args)
end
function p._main(args)
local modules = mTableTools.compressSparseArray(args)
return box .. trackingCategories
end
function p.renderBox(modules)
local boxArgs = {}
if #modules < 1 then
boxArgs.text = '<strong class="error">Error: no modules specified錯誤:未指定模組</strong>'
else
local moduleLinks = {}
end
local moduleList = mList.makeList('bulleted', moduleLinks)
boxArgs.text = 'This ' .. (mw.title.getCurrentTitle():inNamespaces(828,829) and 'module' or 'template') .. ' uses 使用[[Wikipedia:Lua|Lua語言編寫]]:\n' .. moduleList
end
boxArgs.type = 'notice'
boxArgs.small = true
boxArgs.image = '[[File:Lua-logo-nolabel.svg|30px|alt=Lua 标志|link=Wikipedia:Lua]]'
return mMessageBox.main('mbox', boxArgs)
end
function p.renderTrackingCategories(args, modules, titleObj)
if yesno(args.nocat) then
return ''
end
local cats = {}
-- Error category
if #modules < 1 then
cats[#cats + 1] = 'Lua templates with errors模板未指定Lua模組'
end
-- Lua templates category
titleObj = titleObj or mw.title.getCurrentTitle()
if not category then
local categories = {
['Module:String'] = 'Lua String-based templates基于Lua字符串的模板', ['Module:Math'] = 'Templates based on the Math Lua module基於Lua數學模組的模板', ['Module:BaseConvert'] = 'Templates based on the BaseConvert Lua module基于Lua模块BaseConvert的模板', ['Module:Citation'] = 'Lua-based citation templates基于Lua的引用模板'
}
categories['Module:Citation/CS1'] = categories['Module:Citation']
category = modules[1] and categories[modules[1]]
category = category or 'Lua-based templates基于Lua编程语言的模板'
end
cats[#cats + 1] = category
local protLevels = {
autoconfirmed = 1,
extendedconfirmed = 2,
templateeditor = 3,
sysop = 4
}
local currentProt = titleObj.protectionLevels["edit"][1]
if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end
for i, module in ipairs(modules) do
local moduleProt = mw.title.new(module).protectionLevels["edit"][1]
if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end
if moduleProt < currentProt then
cats[#cats + 1] = "Templates using under-protected Lua modules"
break
end
end
end
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category分類:%s]]', cat)
end
return table.concat(cats)
end
return p
行政員使用者查核員拒收員巡檢員管理員、water、waterc、waterh、waterm、waterp、waters、watert、waterv、waterw、waterz
10,317
次編輯