if args[v]['system'] then -- Header row
local stop_noun = data[v]['header stop noun'] or i18n[lang]['stop_noun']
mw.log("BEGIN")
mw.logObject(data[v])
mw.log("BEGIN2")
mw.logObject(args[v])
mw.log("END")
local mainHeader
local subsystem = args[v]['subsystem']
if subsystem and (data[v]['subsystem icons'] or data[v]['subsystem titles']) then
mainHeader = table.concat({((data[v]['subsystem icons'] and data[v]['subsystem icons'][subsystem]) and data[v]['subsystem icons'][subsystem] .. ' ' or ''), ((data[v]['subsystem titles'] and data[v]['subsystem titles'][subsystem]) or '')})
else
mainHeader = table.concat({(data[v]['system icon'] and data[v]['system icon'] .. ' ' or ''), (data[v]['system title'] or ('[['.. args[v]['system'] ..']]'))})
end
table.insert(wikitable, table.concat({'\n|-',
'\n!', style['header cell'], i18n[lang]['preceding'](stop_noun),
'\n!', style['header midcell'], mainHeader(data[v]['system icon'] and data[v]['system icon'] .. ' ' or ''), (data[v]['system title'] or ('[['.. args[v]['system'] ..']]')),
'\n!', style['header cell'], i18n[lang]['following'](stop_noun)
}))
if not inline then -- [[Template:Legend]]
result = '<div class="legend" style="-webkit-column-break-inside:avoid;page-break-inside:avoid;break-inside:avoid-column"><span class="legend-color" style="display:inline-block;width:1.5em;height:1.5em;margin:1px 0;border:1px solid black;background-color:#' .. color .. '"> </span> ' .. line .. result .. '</div>'
elseif inline == 'yes' then
result = '<span style="background-color:#' .. color .. ';border:1px solid #000"> </span> ' .. line .. result
end
else -- [[Template:Legend]] (fallback; duplication to simplify logic)
result = '<div class="legend" style="-webkit-column-break-inside:avoid;page-break-inside:avoid;break-inside:avoid-column"><span class="legend-color" style="display:inline-block;width:1.5em;height:1.5em;margin:1px 0;border:1px solid black;background-color:#' .. color .. '"> </span> ' .. line .. result .. '</div>'
end
end
|