વિભાગ:InfoboxImage: આવૃત્તિઓ વચ્ચેનો તફાવત

Content deleted Content added
No edit summary
No edit summary
લીટી ૪૦:
function i.IsPlaceholder(image)
-- change underscores to spaces
image2image = mw.ustring.gsub(image, "_", " ");
-- if image starts with [[ then remove that and anything after |
if mw.ustring.sub(image2image,1,2) == "[[" then
image2image = mw.ustring.sub(image2image,3);
image2image = mw.ustring.gsub(image2image, "([^|]*)|.*", "%1");
end
-- Trim spaces
image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1');
-- remove file: or image: prefix if exists
if mw.ustring.lower(mw.ustring.sub(image2image,1,5)) == "file:" then
image2image = mw.ustring.sub(image2image,6,mw.ustring.len(image2image));
end
if mw.ustring.lower(mw.ustring.sub(image2image,1,6)) == "image:" then
image2image = mw.ustring.sub(image2image,7,mw.ustring.len(image2image));
end
-- Trim spaces
image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1');
-- capitalise first letter
image2image = mw.ustring.upper(mw.ustring.sub(image2image,1,1)) .. mw.ustring.sub(image2image,2);
 
for i,j in pairs(placeholder_image) do
if image2image == j then
return true
end