Module:Variants: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(Add logic for main variants table (so they are sorted the same))
(Add profession icon, and show both professions in table.)
Line 1: Line 1:
require('Module:Mw.html extension')
local p = {}
local p = {}


Line 12: Line 13:
local query = {
local query = {
'[[Variant of::'..variant_name..']]',
'[[Variant of::'..variant_name..']]',
'?Profession A #', -- Adding a # to this query makes it return plaintext instead of a link
'?Profession B #',
'?Profession Level A',
'?Profession Level A',
'?Profession Level B',
'?Profession Level B',
Line 63: Line 66:
:tag('th')
:tag('th')
:wikitext('Level')
:wikitext('Level')
:attrIf(smw_data[1]['Profession B'], 'colspan', 2)
:done()
:done()
:done()
:done()
Line 78: Line 82:
:done()
:done()
:tag('td')
:tag('td')
:wikitext(entry['Profession Level A'])
:css{ ['border-right'] = 'none' }
:wikitext(entry['Profession Level A']..' [[File:'..entry['Profession A']..' small icon.png|21x21px|link='..entry['Profession A']..']]')
:done()
:IF(entry['Profession B'])
:tag('td')
:wikitextIf(entry['Profession B'], (entry['Profession Level B'] or '')..' [[File:'..(entry['Profession B'] or '')..' small icon.png|21x21px|link='..(entry['Profession B'] or '')..']]')
:done()
:END()
:done()
:done()
end
end