Module:Param Parse: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
mNo edit summary
(Redirect to `_(episode)` if available)
Line 132: Line 132:
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 '[[File:'..valid_episode..' episode icon.png|18px]] [['..valid_episode..']]'
local page_name = valid_episode .. ' (episode)'
-- Check if the page with '(episode)' exists
if mw.title.new(page_name).exists then
return '[[File:'..valid_episode..' episode icon.png|18px]] [['..page_name..']]'
else
-- Fallback to the original episode name
return '[[File:'..valid_episode..' episode icon.png|18px]] [['..valid_episode..']]'
end
end
end
return nil
return nil
end
end