Module:InfoboxImage: Difference between revisions

Jump to navigation Jump to search
imported>WOSlinker
No edit summary
imported>WOSlinker
No edit summary
Line 22: Line 22:
         result = "File:" .. frame.args["image"];
         result = "File:" .. frame.args["image"];
         result = result .. "/" .. (size or sizedefault or "frameless");
         result = result .. "/" .. (size or sizedefault or "frameless");
        if alt ~= "" and alt ~= nil then
            result = result .. "/alt=" .. alt;
        end
          
          
         return result;
         return result;

Revision as of 20:57, 28 August 2012

Documentation for this module may be created at Module:InfoboxImage/doc

local i = {};

function i.InfoboxImage(frame)
    local image = frame.args["image"];
    
    if image == "" or image == nil then
        return ""
    end
    
    if string.sub(frame.args["image"],1,2) == "[[" then
        return frame.args["image"];
    else
        local result = "";
        local size = frame.args["size"];
        local sizedefault = frame.args["sizedefault"];
        local alt = frame.args["alt"];
        
        if (tonumber(size) or 0) > 0 then
            size = size .. "px";
        end
        
        result = "File:" .. frame.args["image"];
        result = result .. "/" .. (size or sizedefault or "frameless");
        if alt ~= "" and alt ~= nil then
            result = result .. "/alt=" .. alt;
        end
        
        return result;
    end
end

return i;