Module:Variants: Difference between revisions

367 bytes added ,  Yesterday at 18:50
Format low➨high for items with a range of profession levels; Align levels to the right
(Add profession icon, and show both professions in table.)
(Format low➨high for items with a range of profession levels; Align levels to the right)
Line 17:
'?Profession Level A',
'?Profession Level B',
'?Profession Level A High',
'?Profession Level B High',
get_images and '?Image#64px;x64px = Image' or nil,
limit = args.limit or 500,
Line 69 ⟶ 71:
:done()
:done()
local function formatProfessionLevel(profession, level, high)
if not profession then
return nil
end
local level_text = tostring(level)
if high then
level_text = ('%s➨%d'):format(level_text, high)
end
return ('%s [[File:%s small icon.png|21x21px|link=%s]]'):format(level_text, profession, profession)
end
 
for _, entry in ipairs(smw_data) do
Line 82 ⟶ 95:
:done()
:tag('td')
:css{ ['bordertext-rightalign'] = 'noneright' }
:wikitext(formatProfessionLevel(entry['Profession Level A']..', [[File:'..entry['Profession Level A']..', small icon.png|21x21px|link='..entry['Profession Level A High']..']]'))
:done()
:IF(entry['Profession B'])
:tag('td')
:css{ ['text-align'] = 'right' }
:wikitextIf(entry['Profession B'], (entry['Profession Level B'] or '')..' [[File:'..(entry['Profession B'] or '')..' small icon.png|21x21px|link='..(entry['Profession B'] or '')..']]')
:wikitext(formatProfessionLevel(entry['Profession B'], entry['Profession Level B'], entry['Profession Level B High']))
:done()
:END()
227

edits