Module:Card: Difference between revisions
No edit summary |
No edit summary |
||
| Line 154: | Line 154: | ||
return normalizeClassName(quality) | return normalizeClassName(quality) | ||
end | |||
local function stripLinkPrefix(value) | |||
value = tostring(value or '') | |||
-- Converts "Luca: Myriad Meadows" to "Myriad Meadows" | |||
-- Only affects the link target, not the displayed card name. | |||
return mw.text.trim(value:gsub('^.-:%s*', '', 1)) | |||
end | end | ||
| Line 239: | Line 247: | ||
-- Type-specific behavior | -- Type-specific behavior | ||
local lcType = tostring(out.type or ''):lower() | local lcType = tostring(out.type or ''):lower() | ||
if lcType == 'neighbor' then | if lcType == 'neighbor' then | ||
if lib.isEmpty(out.label) then | if lib.isEmpty(out.label) then | ||
| Line 248: | Line 256: | ||
end | end | ||
end | end | ||
if tonumber(out.image_size) then | if tonumber(out.image_size) then | ||
out.image_size = tonumber(out.image_size) + 2 | out.image_size = tonumber(out.image_size) + 2 | ||
end | |||
end | |||
if lcType == 'redirect' then | |||
out.defaults.link = stripLinkPrefix(out.name) | |||
-- Safety fallback in case TemplateData does not re-resolve defaults. | |||
if not (out.nonDefaults and out.nonDefaults.link) then | |||
out.link = stripLinkPrefix(out.name) | |||
end | end | ||
end | end | ||