Module:InfoboxImage: Difference between revisions

Jump to navigation Jump to search
m
1 revision
m (1 revision)
 
m (1 revision)
 
(One intermediate revision by the same user not shown)
Line 43: Line 43:
     "Silver - Replace this image female.svg",
     "Silver - Replace this image female.svg",
     "Silver - Replace this image male.svg",
     "Silver - Replace this image male.svg",
    "Replace this image.svg",
"Cricket no pic.png",
"CarersLogo.gif",
"Diagram Needed.svg",
"Example.jpg",
"Image placeholder.png",
"No male portrait.svg",
"Nocover-upload.png",
"NoDVDcover copy.png",
"Noribbon.svg",
"No portrait-BFD-test.svg",
"Placeholder barnstar ribbon.png",
"Project Trains no image.png",
"Image-request.png",
"Sin bandera.svg",
"Sin escudo.svg",
"Replace this image - temple.png",
"Replace this image butterfly.png",
"Replace this image.svg",
"Replace this image1.svg",
"Resolution angle.png",
"Image-No portrait-text-BFD-test.svg",
"Insert image here.svg",
"No image available.png",
"NO IMAGE YET square.png",
"NO IMAGE YET.png",
"No Photo Available.svg",
"No Screenshot.svg",
"No-image-available.jpg",
"Null.png",
"PictureNeeded.gif",
"Place holder.jpg",
"Unbenannt.JPG",
"UploadACopyrightFreeImage.svg",
"UploadAnImage.gif",
"UploadAnImage.svg",
"UploadAnImageShort.svg",
}
}


Line 55: Line 92:
     -- Trim spaces
     -- Trim spaces
     image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1');
     image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1');
     -- remove file: or image: prefix if exists
     -- remove prefix if exists
     if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "file:" then
     local allNames = mw.site.namespaces[6].aliases
        image = mw.ustring.sub(image,6);
    allNames[#allNames + 1] = mw.site.namespaces[6].name
     end
    allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName
    if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "image:" then
     for i, name in ipairs(allNames) do
        image = mw.ustring.sub(image,7);
        if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then
            image = mw.ustring.sub(image, mw.ustring.len(name) + 2);
            break
        end
     end
     end
     -- Trim spaces
     -- Trim spaces
Line 84: Line 124:
         return image;
         return image;
     end
     end
     if frame.args["suppressplaceholder"] == "yes" then
     if frame.args["suppressplaceholder"] ~= "no" then
         if i.IsPlaceholder(image) == true then
         if i.IsPlaceholder(image) == true then
             return "";
             return "";
Line 136: Line 176:
         local center= frame.args["center"];
         local center= frame.args["center"];
          
          
         -- remove file: or image: prefix if exists
         -- remove prefix if exists
         if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "file:" then
         local allNames = mw.site.namespaces[6].aliases
            image = mw.ustring.sub(image,6);
        allNames[#allNames + 1] = mw.site.namespaces[6].name
         end
        allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName
        if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "image:" then
         for i, name in ipairs(allNames) do
            image = mw.ustring.sub(image,7);
            if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then
                image = mw.ustring.sub(image, mw.ustring.len(name) + 2);
                break
            end
         end
         end
          
          
14,061

edits

Navigation menu