開啟主選單

求真百科

變更

模块:Lua banner

增加 786 位元組, 4 年前
导入1个版本
-- [=[ 这个模块由[[Template:Lua]]调用暂无模块调用/****************************/這個 模組 嵌入 由[[Template:Lua]]調用暫無 板{{lua}}組調用]=]--
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"> 錯誤 错误 没有 指定 -{zh-hans:模块; zh-hant: 模組;}-</strong>'
else
local moduleLinks = {}
end
local moduleList = mList.makeList('bulleted', moduleLinks)
boxArgs.text = '本' .. (mw.title.getCurrentTitle():inNamespaces(828,829) and '-{zh-hans:模块; zh-hant:模組;}-' or '模板') .. '使用[[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 模板 未指定Lua模組'
end
-- Lua templates category
titleObj = titleObj or mw.title.getCurrentTitle()
if not category then
local categories = {
['Module:String'] = ' 基于Lua字符串 使用LuaString 的模板', ['Module:Math'] = ' 基於Lua數學模組 使用LuaMath 的模板', ['Module:BaseConvert'] = ' 基于Lua模块BaseConvert 使用LuaBaseConvert 的模板', ['Module:Citation'] = ' 基于Lua 使用LuaCitation 引用 模板'
}
categories['Module:Citation/CS1'] = categories['Module:Citation']
category = modules[1] and categories[modules[1]]
category = category or ' 基于Lua编程语言的 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] = "使用受保护Lua模块的模板"
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
次編輯