模組:Namespace/ForEach
外观

概要
由Module:TemplateParameters#getFormatingStringByArgument擴展而來的用法,用來大量印出一樣的命名空間資料,如Wikipedia:编辑提示#建立編輯提示
參數及使用方法
{{#invoke:Namespace/ForEach|main |template=<nowiki> * {{{nsid}}}:{{{ns}}}({{NSPN|2={{{nsid}}}}})</nowiki> |cond=<nowiki>{{#expr:{{{nsid}}}>=0}}</nowiki> |delnowiki=true |delmingw=true }}
Module:Namespace/ForEach錯誤:沒有提供渲染模板。
- template支援參數列表:
nsid
:命名空間IDns
:命名空間名稱(相當於{{ns:{{{nsid}}}}}
)
- cond支援參數列表:
nsid
:命名空間ID
local p = {}
local mError = require('Module:Error')
local mTemplateParameters = require('Module:TemplateParameters')
local yesno = require('Module:Yesno')
local getArgs = require('Module:Arguments').getArgs
local data = mw.loadData('Module:Namespace/data')
function p._main(args)
local format = args['format'] or args[1] or args['1']
if not format or format == '' then
return mError.error{ '[[Module:Namespace/ForEach]]錯誤:沒有提供渲染模板。' }
end
if args["delnowiki"] then
if yesno(args["delnowiki"]) or false then
format = mw.text.unstripNoWiki(format)
end
end
if args["delmsgnw"] then
if yesno(args["delmsgnw"]) or false then
format = mw.text.decode(format)
end
end
-- FormatingArguments
end
function p.main(frame)
local args = getArgs(frame)
return p._main(args)
end
return p