Editing Module:Variants

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 17: Line 17:
'?Profession Level A',
'?Profession Level A',
'?Profession Level B',
'?Profession Level B',
'?Profession Level A High',
'?Profession Level B High',
get_images and '?Image#64px;x64px = Image' or nil,
get_images and '?Image#64px;x64px = Image' or nil,
limit = args.limit or 500,
limit = args.limit or 500,
Line 59: Line 57:
return ':No variants found.'
return ':No variants found.'
end
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')
local table = mw.html.create('table')
:addClass('sortable wikitable')
:addClass('sortable wikitable')
Line 77: Line 66:
:tag('th')
:tag('th')
:wikitext('Level')
:wikitext('Level')
:attrIf(profession_b_flag, 'colspan', 2)
:attrIf(smw_data[1]['Profession B'], 'colspan', 2)
:done()
:done()
:done()
:done()
local function formatProfessionLevel(profession, level, high)
if not (profession or level) then
return nil
end
profession = profession or 'Unknown profession'
local level_text = tostring(level or '?')
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
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 '?'
local profession_a = entry['Profession A'] or ''
local profession_b = entry['Profession B'] or ''
table
table
:tag('tr')
:tag('tr')
Line 109: Line 82:
:done()
:done()
:tag('td')
:tag('td')
:css{ ['text-align'] = 'right' }
:css{ ['border-right'] = 'none' }
:wikitext(formatProfessionLevel(entry['Profession A'], entry['Profession Level A'], entry['Profession Level A High']))
:wikitext(entry['Profession Level A']..' [[File:'..entry['Profession A']..' small icon.png|21x21px|link='..entry['Profession A']..']]')
:IF(profession_b_flag)
:IF(entry['Profession B'])
:tag('td')
: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 '')..']]')
:IF(entry['Profession B'])
:css{ ['text-align'] = 'right' }
:wikitext(formatProfessionLevel(entry['Profession B'], entry['Profession Level B'], entry['Profession Level B High']))
:done()
:done()
:END()
:END()
Please note that all contributions to Brighter Shores Wiki are considered to be released under the CC BY-NC-SA 3.0 (see Brighter Shores:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template