Changes
Jump to navigation
Jump to search
no edit summary
-- 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.
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
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
if image == "" or image == nil then
return "";
end
if frame.args["suppressplaceholder"] == "yes" then if i.IsPlaceholder(image) == true then return ""; end
end