打开/关闭搜索
搜索
打开/关闭菜单
通知
打开/关闭个人菜单
查看“模块:Infobox/item/image”的源代码
来自Cookie☆Wiki
查看
阅读
查看源代码
查看历史
associated-pages
模块
讨论
更多操作
←
模块:Infobox/item/image
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} function p.make() local frame = mw.getCurrentFrame() local parent = frame:getParent() local arg = parent.args['image'] if string.byte(arg, 1) == 127 then --< 参数可能是 <gallery>…</gallery> return arg -- arg = string.sub(arg, 2, -1) -- pattern = '^%s*<gallery>.*</gallery>%s*$' -- old_arg = arg -- arg = string.match(arg, pattern) -- if arg == nil then -- error('The image argument of this template (module) must be a file name in plain text or a <gallery> element. Test:' .. mw.text.unstrip(parent.args['image'])) -- end -- images = {} -- for image_line in arg: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
本页使用的模板:
模块:Infobox/item/image/doc
(
查看源代码
)
返回
模块:Infobox/item/image
。