更多操作
此模块的文档可以在模块:Infobox/item/image/doc创建
local p = {}
function p.make()
local parent = mw.getCurrentFrame():getParent()
local arg = parent.args['image']
if string.byte(arg, 1) == 127 then --< 参数可能是 <gallery>…</gallery>
arg = string.sub(arg, 2, -1)
images = {}
for image_line in str:gmatch('[^\r\n]+') do
-- table.insert(lines, line)
local sep = image_line:find('|')
table.insert(images, {
file = string.sub(image_line, 1, sep-1),
title = string.sub(image_line, sep+1, -1)
})
end
return mw.dumpObject(images) --< debug
else --< 参数是图片名
return frame:expandTemplate{ title = 'Infobox/item/single image', args = {
image = arg, caption = parent.args['caption']
} }
end
end
return p