Module:InfoboxImage: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 4:
-- sizedefault - default size to display the image if size param is blank
-- alt - alt text for image
-- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it
-- Outputs:
-- Formatted image.
Line 39 ⟶ 40:
function i.IsPlaceholder(image)
-- change underscores to spaces
image2 = mw.ustring.gsub(image, "_", " ");
-- if image starts with [[ then remove that and anything after |
if mw.ustring.sub(image2,1,2) == "[[" then
image2 = mw.ustring.sub(image2,3);
image2 = mw.ustring.gsub(image2, "([^|]*)|.*", "%1");
end
-- remove file: or image: prefix if exists
Line 53 ⟶ 54:
end
-- capitalise first letter
image2 = mw.ustring.upper(mw.ustring.sub(image2,1,1)) .. mw.ustring.sub(image2,2);
 
for i,j in pairs(placeholder_image) do
Line 67 ⟶ 68:
if image == "" or image == nil then
return "";
end
if iframe.IsPlaceholder(image)args["suppressplaceholder"] == true"yes" then
if i.IsPlaceholder(image) == true then
return "";
end
end
 
Anonymous user