Module:SocialMedia: Difference between revisions

No edit summary
No edit summary
Line 2: Line 2:


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- This list gets transcluded based on its position in this Module, so do not alter its position!
-- Lines 5 and 6 get transcluded based on their position in this Module, so do not move them!
-- Currently supported platforms are:
-- Currently supported platforms are:
-- Facebook, Instagram, LinkedIn, Telegram, Threads, TikTok, X/Twitter, Youtube
-- Facebook, Instagram, LinkedIn, Telegram, Threads, TikTok, X/Twitter, Youtube
-- (Update the line above as plaforms get added or removed!)
-- (Update Line 6 as plaforms get added or removed)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- !!! ONLY START EDITING FROM THIS POINT ONWARDS !!!
-- ! ONLY START EDITING FROM THIS POINT ONWARDS !
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------


Line 57: Line 57:
     },
     },
     {
     {
        -- Multiple aliases: the editor can supply "x" or "twitter"
         param  = { "x", "twitter" },
         param  = { "x", "twitter" },
         icon  = "File:SocialXIcon.svg",
         icon  = "File:SocialXIcon.svg",
Line 71: Line 70:
}
}


--------------------------------------------------------------------------------
-- Helper to find the first non-empty user handle from a param or table of params
-- Helper to find the first non-empty user handle from a param or table of params
-- If param is a single string (e.g. "facebook"), we do args["facebook"]
-- If it's a table like { "x", "twitter" }, we check args["x"] then args["twitter"]
--------------------------------------------------------------------------------
local function getUserHandle(args, param)
local function getUserHandle(args, param)
     local handle
     local handle
Line 92: Line 87:
end
end


-- Build a clickable icon link (24px) with alt text for accessibility:
-- Build a clickable icon link (24px) with alt text for accessibility: [[File:Something.svg|24px|alt=ALT_TEXT|link=URL]]
-- [[File:Something.svg|24px|alt=ALT_TEXT|link=URL]]
local function buildIconLink(iconFile, altText, url)
local function buildIconLink(iconFile, altText, url)
     return string.format("[[%s|24px|alt=%s|link=%s]]", iconFile, altText, url)
     return string.format("[[%s|24px|alt=%s|link=%s]]", iconFile, altText, url)