Kirby Wiki
mNo edit summary
m (Undo revision 265635 by Fngplg (talk))
Line 10: Line 10:
 
:gsub('|alt=.-([|%]])', '%1')
 
:gsub('|alt=.-([|%]])', '%1')
 
:gsub('|link=.-([|%]])', '%1')
 
:gsub('|link=.-([|%]])', '%1')
:gsub('%[%[[fF]ile:(.-[^%|%]])%]%]', '%1\n')
+
:gsub('%[%[[fF]ile:(.-[^%|%]])%]%]', '%1')
:gsub('\n\n', '\n')
 
 
return file
 
return file
 
end
 
end

Revision as of 11:34, 2 February 2018

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] or '')
    local param = frame.args[2] or ''
    file = file:gsub('|%d+x?%d*px', '')
        :gsub('|alt=.-([|%]])', '%1')
        :gsub('|link=.-([|%]])', '%1')
        :gsub('%[%[[fF]ile:(.-[^%|%]])%]%]', '%1')
    return file
end

return p