Module:InfoboxImage

From Encyclopedia Westarctica
Revision as of 15:56, 27 July 2025 by Krigsvold (talk | contribs) (Infobox image)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

local p = {}

local function clean(s) if type(s) ~= 'string' then return nil end s = mw.text.trim(s) if s == or s:lower() == 'none' then return nil end return s end

function p.InfoboxImage(frame) local args = frame:getParent().args local image = clean(args.image) or 'No image.svg' local size = clean(args.size) or '220px' local alt = clean(args.alt) or local title = clean(args.title) local link = clean(args.link)

local options = { alt = alt, title = title, link = link, class = 'infobox-image', }

local imageTag = mw.getCurrentFrame():extensionTag('image', , { src = image, width = size, alt = alt, title = title })

-- Fallback if extensionTag fails (older wikis) if not imageTag or imageTag == then local out = '' .. title end out = out .. '' return out end

return imageTag end

return p