模块:黑暗教典
跳转到导航
跳转到搜索
可在模块:黑暗教典/doc创建此模块的帮助文档
local p = {}
function p.test(frame)
local args = (frame == mw.getCurrentFrame() and frame.args) or frame
lines=split(args.data,'\n')
local r=""
for i = 1, #lines do
temp=frame:expandTemplate{title='黑暗教典',args={lines[i]}}
temp=split(temp,'\n')[2]
r=r.."[["..string.sub(lines[i],2)..'|x400px|thumb|left|<center>'..temp..'</center>]]\n\n'
end
return r
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