Module:InfoboxHero: Difference between revisions

add tooltips (the fancy template style)
change tooltip type (the boring html title style)
Line 616: Line 616:
local tr = tbl:tag('tr')
local tr = tbl:tag('tr')
local label = dict_module.translate(row.label_dict)
local label = dict_module.translate(row.label_dict)
local label_cell = tr:tag('td')
if row.tooltip then
if row.tooltip then
label = ctx.frame:expandTemplate{ title = 'Tooltip', args = { label, row.tooltip } }
label_cell:attr('title', row.tooltip)
end
end
if row.link then
if row.link then
tr:tag('td'):wikitext(string.format('[[%s|<span>%s</span>]]:',
label_cell:wikitext(string.format('[[%s|<span>%s</span>]]:',
page_link(ctx, row.link), label))
page_link(ctx, row.link), label))
else
else
tr:tag('td'):wikitext(label .. ':')
label_cell:wikitext(label .. ':')
end
end
tr:tag('td'):wikitext(ctx.args[row.param])
tr:tag('td'):wikitext(ctx.args[row.param])