Module:MediaCleaner

local p = {}

function p.clean(frame) local arg, media = frame:getParent.args[1], {} arg = string.gsub(arg, " ", "") -- Remove spaces local m, n = mw.text.split(arg, ","), {}

for _, l in ipairs(m) do       if (not media[l]) then n[#n+1] = l           media[l] = true end end

if #media > 3 then if media.Anime or media.Manga then return "" end elseif #media == 3 and media.Manga then return "" else if media.Anime and media.Manga then return "" end if media.Moviecanon and media.Manga then return "" end if media.Anime then return "Anime" end if media.Manga then return "Manga" end end arg = table.concat(n, ",") arg = string.gsub(string.gsub(arg, "%(", ""), "%)", "") return arg end

return p