Module:Expanded infobox image: Difference between revisions

From Geometry Dash Expanded Wiki
Jump to navigation Jump to search
Handle infobox filenames, image markup, and gallery strip markers correctly
 
Use existing gallery captions for profile image tabs
Tag: Manual revert
 
(2 intermediate revisions by the same user not shown)
(No difference)

Latest revision as of 19:07, 12 October 2026

Documentation for this module may be created at Module:Expanded infobox image/doc

local p = {}
function p.render(frame)
    local value = mw.text.trim(frame.args[1] or '')
    if value == '' then return '' end
    -- Gallery tags arrive as parser strip markers. Preserve those and supplied markup.
    if value:find(string.char(127), 1, true) or value:find('[[', 1, true) or value:find('<', 1, true) then
        return value
    end
    value = value:gsub('^[Ff][Ii][Ll][Ee]:', ''):gsub('^[Ii][Mm][Aa][Gg][Ee]:', '')
    if mw.text.trim(value) == '' then return '' end
    local width = tonumber(frame.args.width) or 300
    if width < 1 or width > 2000 then width = 300 end
    return '[[File:' .. value .. '|' .. math.floor(width) .. 'px]]'
end
return p