MCBBS Wiki欢迎您共同参与编辑!在参与编辑之前请先阅读Wiki方针。
如果在编辑的过程中遇到了什么问题,可以去讨论板提问。
为了您能够无阻碍地参与编辑 未验证/绑定过邮箱的用户,请尽快绑定/验证。
MCBBS Wiki GitHub群组已上线!
您可以在回声洞中发表吐槽!
服务器状态监控。点击进入
本站由MCBBS用户自行搭建,与MCBBS及东银河系漫游指南(北京)科技有限公司没有从属关系。点此了解 MCBBS Wiki 不是什么>>
模块:AutoUGroup:修订间差异
跳到导航
跳到搜索
无编辑摘要 |
无编辑摘要 |
||
| 第3行: | 第3行: | ||
local p = {} | local p = {} | ||
local function genGroupWT(group,useIcon) | local function genGroupWT(group,useIcon,useCat) | ||
local res="" | local res="" | ||
if(useIcon) then | if(useIcon) then | ||
| 第9行: | 第9行: | ||
end | end | ||
res=res.."[["..group.link.."|"..group.name.."]]" | res=res.."[["..group.link.."|"..group.name.."]]" | ||
res=res.."[[Category:"..group.cat.."]]" | if(useCat) then | ||
res=res.."[[Category:"..group.cat.."]]" | |||
end | |||
return res | return res | ||
end | end | ||
| 第15行: | 第17行: | ||
function p.group(frame) | function p.group(frame) | ||
local icon | local icon | ||
local cat | |||
local args = require('Module:Arguments').getArgs(frame) | local args = require('Module:Arguments').getArgs(frame) | ||
if(args["icon"]==nil) then | if(args["icon"]==nil) then | ||
| 第21行: | 第24行: | ||
icon = yesno(args["icon"],true) | icon = yesno(args["icon"],true) | ||
end | end | ||
if(args[1]==nil) then | if(args["cat"]==nil) then | ||
cat = true | |||
else | |||
cat = yesno(args["cat"],true) | |||
end | |||
if(args[1]==nil and cat) then | |||
return "[[分类:模板参数填写错误的条目]]" | return "[[分类:模板参数填写错误的条目]]" | ||
end | end | ||
| 第27行: | 第35行: | ||
for txtk,txtv in ipairs(gv.str) do | for txtk,txtv in ipairs(gv.str) do | ||
if(txtv==args[1]) then | if(txtv==args[1]) then | ||
return genGroupWT(gv,icon) | return genGroupWT(gv,icon,cat) | ||
end | end | ||
end | end | ||
end | end | ||
return args[1].."[[分类:模板参数填写错误的条目]]" | if(cat) then | ||
return args[1].."[[分类:模板参数填写错误的条目]]" | |||
else | |||
return "" | |||
end | |||
end | end | ||
return p | return p | ||
2023年8月2日 (三) 18:22的版本
可在模块:AutoUGroup/doc创建此模块的帮助文档
local map=require('Module:AutoUGroup/Mapping')
local yesno=require("Module:Yesno")
local p = {}
local function genGroupWT(group,useIcon,useCat)
local res=""
if(useIcon) then
res=res.."[[File:"..group.icon.."]]"
end
res=res.."[["..group.link.."|"..group.name.."]]"
if(useCat) then
res=res.."[[Category:"..group.cat.."]]"
end
return res
end
function p.group(frame)
local icon
local cat
local args = require('Module:Arguments').getArgs(frame)
if(args["icon"]==nil) then
icon = true
else
icon = yesno(args["icon"],true)
end
if(args["cat"]==nil) then
cat = true
else
cat = yesno(args["cat"],true)
end
if(args[1]==nil and cat) then
return "[[分类:模板参数填写错误的条目]]"
end
for gk,gv in ipairs(map) do
for txtk,txtv in ipairs(gv.str) do
if(txtv==args[1]) then
return genGroupWT(gv,icon,cat)
end
end
end
if(cat) then
return args[1].."[[分类:模板参数填写错误的条目]]"
else
return ""
end
end
return p