Editing Module:Expanded infobox image

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision Your text
Line 3: Line 3:
     local value = mw.text.trim(frame.args[1] or '')
     local value = mw.text.trim(frame.args[1] or '')
     if value == '' then return '' end
     if value == '' then return '' end
     -- Gallery tags arrive as parser strip markers. Preserve those and supplied markup.
     local width = tonumber(frame.args.width) or 300
     if value:find(string.char(127), 1, true) or value:find('[[', 1, true) or value:find('<', 1, true) then
     if width < 1 or width > 2000 then width = 300 end
         return value
    local expanded = mw.text.unstrip(value)
    if expanded:find('class="gallery', 1, true) then
        local tabs = {}
        for box in expanded:gmatch('<li class="gallerybox"(.-)</li>') do
            local url = box:match('href="([^"]+)"')
            local label = box:match('<div class="gallerytext">(.-)</div>')
            local file = url and mw.uri.decode(url):match('/[Ff]ile:(.+)')
            if not file then return value end
            file = mw.text.decode(file):gsub('_', ' ')
            label = mw.text.trim(mw.text.decode((label or ''):gsub('<[^>]+>', '')))
            label = label:gsub('[\r\n=|]', ' ')
            if label == '' then label = 'Image ' .. (#tabs + 1) end
            tabs[#tabs + 1] = label .. '=\n[[File:' .. file .. '|' .. math.floor(width) .. 'px]]'
        end
         if #tabs > 1 then
            return '<div class="expanded-profile-image-tabs">' .. frame:extensionTag('tabber', table.concat(tabs, '\n|-|\n')) .. '</div>'
        end
     end
     end
    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]:', '')
     value = value:gsub('^[Ff][Ii][Ll][Ee]:', ''):gsub('^[Ii][Mm][Aa][Gg][Ee]:', '')
     if mw.text.trim(value) == '' then return '' end
     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]]'
     return '[[File:' .. value .. '|' .. math.floor(width) .. 'px]]'
end
end
return p
return p
Please note that all contributions to Geometry Dash Expanded Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Geometry Dash Expanded Wiki:Copyrights for details). Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)

Page included on this page: