Module:InfoboxImage: Difference between revisions
From Roses, Tulips, & Liberty
Content added Content deleted
No edit summary |
No edit summary |
||
Line 40: | Line 40: | ||
function i.IsPlaceholder(image) |
function i.IsPlaceholder(image) |
||
-- change underscores to spaces |
-- change underscores to spaces |
||
image = mw.ustring.gsub(image, "_", " "); |
|||
-- if image starts with [[ then remove that and anything after | |
-- if image starts with [[ then remove that and anything after | |
||
if mw.ustring.sub( |
if mw.ustring.sub(image,1,2) == "[[" then |
||
image = mw.ustring.sub(image,3); |
|||
image = mw.ustring.gsub(image, "([^|]*)|.*", "%1"); |
|||
end |
end |
||
-- Trim spaces |
|||
image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); |
|||
-- remove file: or image: prefix if exists |
-- remove file: or image: prefix if exists |
||
if mw.ustring.lower(mw.ustring.sub( |
if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "file:" then |
||
image = mw.ustring.sub(image,6,mw.ustring.len(image)); |
|||
end |
end |
||
if mw.ustring.lower(mw.ustring.sub( |
if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "image:" then |
||
image = mw.ustring.sub(image,7,mw.ustring.len(image)); |
|||
end |
end |
||
-- Trim spaces |
|||
image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); |
|||
-- capitalise first letter |
-- capitalise first letter |
||
image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2); |
|||
for i,j in pairs(placeholder_image) do |
for i,j in pairs(placeholder_image) do |
||
if |
if image == j then |
||
return true |
return true |
||
end |
end |