Documentation for this module may be created at Module:Filestrip/doc
-- <nowiki>
-- Lua module that changes file links in infoboxes
-- to proper infobox gallery items
local p = {}
function p.strip(frame)
local file = mw.text.trim(frame.args[1])
local param = frame.args[2]
local iterator = file:gmatch('%[%[File:[^%|]*|%d+px%]%]')
local count = 0
local entry = ''
local entries = {}
for file in iterator do
count = count + 1
entries[count] = file:sub(8, -9)
end
for i, v in ipairs(entries) do
if count == 1 then
entry = v .. ' | ' .. param
else
entry = entry .. '\n' .. v .. ' | ' .. param .. ' (' .. i .. ')'
end
end
return mw.text.trim(entry)
end
return p