Module:FormatDownloads
Documentation for this module may be created at Module:FormatDownloads/doc
local FormatSocials= {}
local SiteNames = {
["https://github.com/"] = "GitHub",
["https://store.steampowered.com/app/"] = "Steam Page",
["https://www.mediafire.com/"] = "Steam Group",
["https://www.dropbox.com/"] = "Dropbox",
["https://www.moddb.com/"] = "ModDB",
["https://gamebanana.com/"] = "Game Banana",
}
function FormatSocials.Format(frame)
local Input = frame.args[1] or ""
local Parts = {}
for Word in string.gmatch(Input, '([^,]+)') do
table.insert(Parts, Word)
end
local Result = {}
for i, Part in ipairs(Parts) do
local DisplayTitle = nil
for url, name in pairs(SiteNames) do
if string.find(Part, url) then
DisplayTitle = name
break
end
end
if DisplayTitle then
table.insert(Result, string.format("[%s %s]", Part, DisplayTitle))
else
table.insert(Result, string.format("[%s Website]", Part, Part))
end
end
return table.concat(Result, "<br>")
end
return FormatSocials