模块:配图轮播
跳转到导航
跳转到搜索
可在模块:配图轮播/doc创建此模块的帮助文档
local p = {}
function p.Parse(frame)
local args = (frame == mw.getCurrentFrame() and frame.args) or frame
if (args~='') then
lines=split(args.data,'\n')
local r="<div class='lunbo' style='display:none'>"
for i = 1, #lines do
temp = ''
temp=frame:expandTemplate{title='模板:配图轮播',args={string.gsub(lines[i],'\|.*','')}}
if(temp~='') then
temp=split(temp,'\n')[2]
end
r=r.."<div>".."<h3><span class='mw-headline' >"..temp.."</span></h3>[["..lines[i]..'|500px]]</div>'
end
return r.."</div>"
end
end
function split(input, delimiter)
input = tostring(input)
delimiter = tostring(delimiter)
if (delimiter=='') then return false end
local pos,arr = 0, {}
for st,sp in function() return string.find(input, delimiter, pos, true) end do
table.insert(arr, string.sub(input, pos, st - 1))
pos = sp + 1
end
table.insert(arr, string.sub(input, pos))
return arr
end
return p