Module:Variants: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
m (spaces to tabs) |
(For equiptment with grades, show "Grade N" as the variant name) |
||
Line 37: | Line 37: | ||
local formatted = {} |
local formatted = {} |
||
for _, entry in ipairs(smw_data) do |
for _, entry in ipairs(smw_data) do |
||
local variant_name = entry['Variant name'] |
|||
if variant_name then |
|||
local page = entry[1] |
local page = entry[1] |
||
local pipe = page:find('|') |
local pipe = page:find('|') |
||
Line 45: | Line 46: | ||
page = page:sub(3, -3) |
page = page:sub(3, -3) |
||
end |
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) |
|||
mw.log('"' .. grade_number .. '"') |
|||
variant_name = 'Grade ' .. grade_number |
|||
end |
|||
⚫ | |||
else |
else |
||
table.insert(formatted, entry[1]) |
table.insert(formatted, entry[1]) |