Module:Param Parse: Difference between revisions

154 bytes added ,  Yesterday at 11:31
Sort episodes by episode number instead of name
m (support variant_type = bounty)
(Sort episodes by episode number instead of name)
Line 213:
-- Episode
local valid_episodes = {
['none'] = { 0, 'None' },
['hopeport'] = { 1, 'Hopeport' },
['hopeforest'] = { 2, 'Hopeforest' },
['mine of mantuban'] = { 3, 'Mine of Mantuban' },
['crenopolis'] = { 4, 'Crenopolis' },
['stonemaw hill'] = { 5, 'Stonemaw Hill' },
['bleakholm crags'] = { 6, 'Bleakholm Crags' },
}
function parse.episode_func(episode)
local valid_episode = valid_episodes[string.lower(episode or '')]
if valid_episode then
local sort = valid_episode[1]
if valid_episode == 'None' then
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..']]'
if valid_episodesort == 'None'0 then
name = 'Unknown'
link = ''
label = 'None'
end
return ('<span data-sort-value="%s">[[File:%s episode icon.png|18px|link=%s]] %s</span>'):format(sort, name, link, label)
end
return nil
Line 235 ⟶ 240:
local valid_episode = valid_episodes[string.lower(episode or '')]
if valid_episode then
return valid_episode[2]
end
return nil
1,524

edits