Module:Param Parse: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
m (support variant_type = bounty) |
(Sort episodes by episode number instead of name) |
||
Line 213: | Line 213: | ||
-- Episode |
-- Episode |
||
local valid_episodes = { |
local valid_episodes = { |
||
['none'] = 'None', |
['none'] = { 0, 'None' }, |
||
['hopeport'] = 'Hopeport', |
['hopeport'] = { 1, 'Hopeport' }, |
||
['hopeforest'] = 'Hopeforest', |
['hopeforest'] = { 2, 'Hopeforest' }, |
||
['mine of mantuban'] = 'Mine of Mantuban', |
['mine of mantuban'] = { 3, 'Mine of Mantuban' }, |
||
['crenopolis'] = 'Crenopolis', |
['crenopolis'] = { 4, 'Crenopolis' }, |
||
['stonemaw hill'] = 'Stonemaw Hill', |
['stonemaw hill'] = { 5, 'Stonemaw Hill' }, |
||
['bleakholm crags'] = 'Bleakholm Crags' |
['bleakholm crags'] = { 6, 'Bleakholm Crags' }, |
||
} |
} |
||
function parse.episode_func(episode) |
function parse.episode_func(episode) |
||
local valid_episode = valid_episodes[string.lower(episode or '')] |
local valid_episode = valid_episodes[string.lower(episode or '')] |
||
if valid_episode then |
if valid_episode then |
||
local sort = valid_episode[1] |
|||
⚫ | |||
local name = valid_episode[2] |
|||
return '[[File:Unknown episode icon.png|18px|link=]] None' |
|||
local link = name |
|||
else |
|||
local label = '[[' .. name .. ']]' |
|||
return '[[File:'..valid_episode..' episode icon.png|18px|link='..valid_episode..']] [['..valid_episode..']]' |
|||
⚫ | |||
name = 'Unknown' |
|||
link = '' |
|||
label = 'None' |
|||
end |
end |
||
return ('<span data-sort-value="%s">[[File:%s episode icon.png|18px|link=%s]] %s</span>'):format(sort, name, link, label) |
|||
end |
end |
||
return nil |
return nil |
||
Line 235: | Line 240: | ||
local valid_episode = valid_episodes[string.lower(episode or '')] |
local valid_episode = valid_episodes[string.lower(episode or '')] |
||
if valid_episode then |
if valid_episode then |
||
return valid_episode |
return valid_episode[2] |
||
end |
end |
||
return nil |
return nil |