Module:Variants: Difference between revisions

Fix link output
(For equiptment with grades, show "Grade N" as the variant name)
(Fix link output)
Line 20:
'?Profession Level B High',
'?Variant name',
'?Version anchor',
'?#-',
get_images and '?Image#64px;x64px = Image' or nil,
limit = args.limit or 500,
Line 40 ⟶ 42:
if variant_name then
local page = entry[1]
local pipe = page:find('|')
if pipe then
page = page:sub(3, pipe-1)
else
page = page:sub(3, -3)
end
 
if page:sub(1, 1 + #variant_name + #' (grade ') == ':' .. variant_name .. ' (grade ' and page:sub(-1) == ')' then
local grade_number = page:sub(2 + #variant_name + #' (grade ', -2)
Line 52 ⟶ 47:
variant_name = 'Grade ' .. grade_number
end
local anchor = entry['Version anchor'] and ' § ' .. entry['Version anchor'] or ''
 
table.insert(formatted, ('[[%s|%s%s]]'):format(page, variant_name, anchor))
else
table.insert(formatted, ('[[%s]]'):format(entry[1]))
end
end
contents = table.concat(formatted, '  • ')
else
contents = '[[Category:Empty variant list]]'
Line 126 ⟶ 122:
:tag('td')
:css{ ['border-left'] = 'none' }
:wikitext(('[[%s]]'):format(entry[1]))
:done()
:tag('td')