Editing Module:Sandbox/User:Microbrews/Variants
Jump to navigation
Jump to search
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 33: | Line 33: | ||
function p.variants_header(args) |
function p.variants_header(args) |
||
local smw_data = get_table_info(args) |
local smw_data = get_table_info(args) |
||
local main_variant = args[1]:gsub(' |
local main_variant = args[1]:gsub('(%()(%))', '%1%(%2%)') |
||
local contents |
local contents |
||
if smw_data then |
if smw_data then |
||
Line 40: | Line 40: | ||
local name = entry['page'] |
local name = entry['page'] |
||
local variant_name = name:gsub(main_variant, '', 1) |
local variant_name = name:gsub(main_variant, '', 1) |
||
⚫ | |||
variant_name = variant_name:gsub('^%s*(.-)%s*$', '%1') -- trim whitespace |
|||
variant_name = variant_name:gsub('%((.-)%)$', '%1') -- trim parentheses |
|||
variant_name = variant_name:gsub("^%l", string.upper) -- capitalize first letter |
|||
⚫ | |||
end |
end |
||
contents = table.concat(formatted, ' • ') |
contents = table.concat(formatted, ' • ') |
||
Line 113: | Line 110: | ||
:tag('td') |
:tag('td') |
||
:css{ ['border-left'] = 'none' } |
:css{ ['border-left'] = 'none' } |
||
:wikitext( |
:wikitext(entry[1]) |
||
:done() |
:done() |
||
:tag('td') |
:tag('td') |