Module:CRTModel: Difference between revisions
No edit summary |
No edit summary |
||
| Line 280: | Line 280: | ||
css(modsDiv, 'grid-column: 1 / -1; padding:0.2em 0.4em;') | css(modsDiv, 'grid-column: 1 / -1; padding:0.2em 0.4em;') | ||
local | -- Build the list HTML manually as a string | ||
local listItems = {} | |||
for _, mod in ipairs(mods) do | for _, mod in ipairs(mods) do | ||
-- Determine display text: use description if available, otherwise type | -- Determine display text: use description if available, otherwise type | ||
local displayText = mod.description or mod.type | local displayText = mod.description or mod.type | ||
| Line 292: | Line 290: | ||
local isFeasible = mod.feasible ~= 'No' | local isFeasible = mod.feasible ~= 'No' | ||
local itemHtml | |||
if isFeasible then | if isFeasible then | ||
-- Normal link for feasible mods | -- Normal link for feasible mods | ||
itemHtml = string.format( | |||
'<li><a href="%s" rel="nofollow" class="external">%s</a></li>', | |||
mod.url, | |||
displayText | |||
) | |||
else | else | ||
-- Red styling with X for impossible mods | -- Red styling with X for impossible mods | ||
itemHtml = string.format( | |||
'<li><span style="color:#dc2626;">✗ <a href="%s" rel="nofollow" class="external" style="color:#dc2626;">%s</a> <i style="font-size:0.9em;">(not possible)</i></span></li>', | |||
mod.url, | |||
displayText | |||
) | |||
end | end | ||
table.insert(listItems, itemHtml) | |||
end | end | ||
modsDiv: | local ulHtml = '<ul style="margin:0;padding-left:1.5em;">' .. table.concat(listItems, '') .. '</ul>' | ||
modsDiv:wikitext(ulHtml) | |||
end | end | ||