Module:Card: Difference between revisions
ReisuDesign (talk | contribs) Undo revision 32044 by ReisuDesign (talk) Tag: Undo |
ReisuDesign (talk | contribs) No edit summary |
||
| Line 199: | Line 199: | ||
-- Generates an icon for the second item in a split card. | -- Generates an icon for the second item in a split card. | ||
-- Uses the same filename convention as Recipe. | -- Uses the same filename convention as Recipe. | ||
local function makeSplitIcon(name) | local function makeSplitIcon(name, mini) | ||
name = tostring(name or '') | name = tostring(name or '') | ||
local | |||
local size = mini and 56 or 74 | |||
return '[[File:' .. | return '[[File:' .. | ||
lib.sanitizeFileName(name) .. | |||
' Icon.png| | ' Icon.png|' .. | ||
size .. 'x' .. size .. | |||
'px|link=' .. name .. | |||
']]' | ']]' | ||
end | end | ||
| Line 385: | Line 387: | ||
-- Required by existing Recipe CSS | -- Required by existing Recipe CSS | ||
if isSplit then | if isSplit then | ||
imageContainer:addClass('recipe-type-split-image') | |||
imageContainer:tag('span') | |||
:addClass('recipe-type-split-half') | |||
:addClass('recipe-type-split-half-a') | |||
:wikitext(a.image_wikitext) | |||
imageContainer:tag('span') | |||
:addClass('recipe-type-split-half') | |||
:addClass('recipe-type-split-half-b') | |||
:wikitext(makeSplitIcon(a.split, a.mini)) | |||
else | |||
imageContainer:wikitext(a.image_wikitext) | |||
end | end | ||
| Line 476: | Line 490: | ||
-- Caption | -- Caption | ||
if isSplit then | if a.show_caption and isSplit then | ||
local node_caption = node_container:tag('span') | local node_caption = node_container:tag('span') | ||
:addClass('card-caption') | :addClass('card-caption') | ||
:addClass('card-split-caption') | |||
node_caption: | |||
'[[ | local list = node_caption:tag('span') | ||
:addClass('card-split-caption-list') | |||
list:tag('span') | |||
:addClass('card-split-caption-item') | |||
:wikitext('[[' .. a.name .. ']]') | |||
list:tag('span') | |||
:addClass('card-split-caption-item') | |||
:wikitext('[[' .. a.split .. ']]') | |||
setCaptionWidth(node_caption, a.caption_width) | setCaptionWidth(node_caption, a.caption_width) | ||
elseif a.show_caption and ne(a.caption) then | elseif a.show_caption and ne(a.caption) then | ||
local node_caption = node_container:tag('span') | local node_caption = node_container:tag('span') | ||
:addClass('card-caption') | :addClass('card-caption') | ||
if a.no_link or lib.isEmpty(a.final_link) then | if a.no_link or lib.isEmpty(a.final_link) then | ||
node_caption:wikitext(a.caption) | node_caption:wikitext(a.caption) | ||
| Line 497: | Line 519: | ||
) | ) | ||
end | end | ||
setCaptionWidth(node_caption, a.caption_width) | setCaptionWidth(node_caption, a.caption_width) | ||
end | end | ||