Module:FilenameChecker

p = {}

local function makeCategoryLink(cat) return string.format('', cat) end

function p.main(frame) local title = mw.title.getCurrentTitle if title.namespace ~= 6 then return '' end local ret = {''} local filename = title.text local filename2 = mw.ustring.lower(filename) if mw.ustring.match(filename2, '%.png%.png$') or mw.ustring.match(filename2, '%.jpg%.jpg$') then ret[#ret + 1] = makeCategoryLink('Images with double extensions in filename') end if mw.ustring.match(filename2, '%.jpeg$') then ret[#ret + 1] = makeCategoryLink('Images with extended extensions in filename') end if mw.ustring.match(filename, '%.JPG$') or mw.ustring.match(filename, '%.PNG$') then ret[#ret + 1] = makeCategoryLink('Images with capitalized extensions in filename') end if mw.ustring.match(filename2, 'image') or mw.ustring.match(filename2, 'screenshot') then ret[#ret + 1] = makeCategoryLink('Images with generic strings in filename') elseif mw.ustring.match(filename2, 'file') and not (		mw.ustring.match(filename2, 'profile') or		mw.ustring.match(filename2, 'fact ?file')	) then ret[#ret + 1] = makeCategoryLink('Images with generic strings in filename') end if mw.ustring.match(filename, "[%/%?%&%,%'%+%!%(%)]") then ret[#ret + 1] = makeCategoryLink('Images with annoying characters in filename') else for code in mw.ustring.gcodepoint(filename) do			if code 122 then ret[#ret + 1] = makeCategoryLink('Images with annoying characters in filename') break end end end return table.concat(ret) end

return p