Module:Sandbox/User:Microbrews/Variants: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
Line 13: Line 13:
local query = {
local query = {
'[[Variant of::'..variant_name..']]',
'[[Variant of::'..variant_name..']]',
'?Name',
'?#-=page',
'?Profession A #', -- Adding a # to this query makes it return plaintext instead of a link
'?Profession A #', -- Adding a # to this query makes it return plaintext instead of a link
'?Profession B #',
'?Profession B #',
Line 38: Line 38:
local formatted = {}
local formatted = {}
for _, entry in ipairs(smw_data) do
for _, entry in ipairs(smw_data) do
local name = entry['Name']
local name = entry['page']
local variant_name = name:gsub(' ' .. main_variant .. '$', '', 1)
local variant_name = name:gsub(' ' .. main_variant .. '$', '', 1)
table.insert(formatted, '[[' .. name .. '|' .. variant_name .. ']]')
table.insert(formatted, '[[' .. name .. '|' .. variant_name .. ']]')