Difference between revisions of "Module:InfoboxImage"
Jump to navigation
Jump to search
(Infobox image) |
|||
Line 18: | Line 18: | ||
local link = clean(args.link) | local link = clean(args.link) | ||
local | local result | ||
if link then | |||
result = string.format('[[File:%s|%s|alt=%s|link=%s', image, size, alt, link) | |||
else | |||
result = string.format('[[File:%s|%s|alt=%s', image, size, alt) | |||
end | |||
if title then | |||
result = result .. '|' .. title | |||
end | end | ||
return | result = result .. ']]' | ||
return result | |||
end | end | ||
return p | return p |
Latest revision as of 15:59, 27 July 2025
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 result
if link then result = string.format('[[File:%s|%s|alt=%s|link=%s', image, size, alt, link) else result = string.format('' .. title end result = result .. ''
return result end
return p