Module:FormatSocials
Documentation for this module may be created at Module:FormatSocials/doc
local FormatSocials= {}
local SiteNames = {
["https://x.com/"] = "Twitter/X",
["https://twitter.com/"] = "Twitter/X",
["https://www.youtube.com/"] = "YouTube",
["https://github.com/"] = "GitHub",
["https://bsky.app/"] = "BlueSky",
["https://youtube.com/"] = "YouTube",
["https://steamcommunity.com/"] = "Steam",
["https://discord.com/"] = "Discord",
["https://discord.gg/"] = "Discord",
["https://discord.gg/"] = "Discord",
["https://www.moddb.com/"] = "ModDB",
["https://gamebanana.com/"] = "ModDB",
["https://community.lambdageneration.com"] = "Lambda Generation",
}
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 -- HEY MIXER, this is the bad case when nothing is found so it just displays the url
table.insert(Result, string.format("[%s Website]", Part, Part))
end
end
return table.concat(Result, "<br>")
end
return FormatSocials