모듈:Params
이 모듈에 대한 설명문서는 모듈:Params/설명문서에서 만들 수 있습니다
local p = {}
function p.parent(frame)
local par = frame:getParent()
for depth = frame.args.depth or 1, depth, -1 do
par = par:getParent()
end
return par.args[frame.args[1]] or frame.args[2]
end
function p.each(frame)
local par = frame:getParent()
local tf = require('모듈:TemplateFunction')
local txt = ''
for depth = frame.args.depth or 1, depth, -1 do
par = par:getParent()
end
for value in ipairs(par.args) do
txt = txt .. tf.create(frame.args[1]):parse(value)
end
return txt
end
function p.join(frame)
local par = frame:getParent()
local txt = ''
for depth = frame.args.depth or 1, depth, -1 do
par = par:getParent()
end
for value in ipairs(par.args) do
txt = txt .. value
end
return txt
end
function p.has(frame)
local par = frame:getParent()
local valt = {}
local result = true
for depth = frame.args.depth or 1, depth, -1 do
par = par:getParent()
end
for index = 1, index <= #frame.args do
if par.args[index] == nil then break end
valt[par.args[index]] = true
end
if valt[frame.args[1]] ~= true then
result = false
end
if result
then return frame.args[2] or ""
else return frame.args[3] or ""
end
end
return p