Module:Variants: Difference between revisions

427 bytes added ,  Yesterday at 19:02
Fix errors
(Format low➨high for items with a range of profession levels; Align levels to the right)
(Fix errors)
Line 59:
return ':No variants found.'
end
local profession_b_flag = false
for _, entry in ipairs(smw_data) do
if entry['Profession B'] or entry['Profession Level B'] then
profession_b_flag = true
end
break
end
local table = mw.html.create('table')
:addClass('sortable wikitable')
Line 68 ⟶ 77:
:tag('th')
:wikitext('Level')
:attrIf(smw_data[1]['Profession B']profession_b_flag, 'colspan', 2)
:done()
:done()
Line 76 ⟶ 85:
return nil
end
local level_text = tostring(level or '?')
if high then
level_text = ('%s➨%d'):format(level_text, high)
Line 84 ⟶ 93:
 
for _, entry in ipairs(smw_data) do
local profession_level_a = entry['Profession Level A'] or '?'
local profession_level_b = entry['Profession Level B'] or '?'
:IF(local profession_a = entry['Profession BA']) or ''
local profession_b = entry['Profession B'] or ''
table
:tag('tr')
Line 97 ⟶ 110:
:css{ ['text-align'] = 'right' }
:wikitext(formatProfessionLevel(entry['Profession A'], entry['Profession Level A'], entry['Profession Level A High']))
:doneIF(profession_b_flag)
:IF(entry['Profession B'])
:tag('td')
:IF(entry['Profession B'])
:css{ ['text-align'] = 'right' }
:wikitext(formatProfessionLevel(entry['Profession B'], entry['Profession Level B'], entry['Profession Level B High']))