Module:Episode: Difference between revisions
Appearance
Content deleted Content added
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
local data = |
local data = require("Module:Episode/data") |
||
local p={} |
local p = {} |
||
function p. |
function p.getEpisode(frame) |
||
local key = string.lower(frame.args[1] or "") |
|||
local entry = data[key] |
|||
local nmspace, episodelink, episodetitle = unpack(data[episode]) |
|||
if nmspace == "" then |
|||
if not entry then |
|||
return string.format("Episode link = %s, Episode title = %s", episodelink, episodetitle) |
|||
return "Episode not found" |
|||
| ⚫ | |||
| ⚫ | |||
return string.format("Namespace = " .. nmspace .. ", Episode link = ") -- .. episodelink .. ", Episode title = " .. episodetitle) |
|||
| ⚫ | |||
local ns, link, title = unpack(entry) |
|||
-- If namespace is empty or nil, omit it |
|||
if ns == "" or ns == nil then |
|||
return string.format("[[%s|%s]]", link, title) |
|||
| ⚫ | |||
return string.format("[[%s:%s|%s]]", ns, link, title) |
|||
end |
|||
end |
end |
||
Revision as of 17:04, 21 July 2025
| You might want to create a documentation page for this Scribunto module. Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this module. |
local data = require("Module:Episode/data")
local p = {}
function p.getEpisode(frame)
local key = string.lower(frame.args[1] or "")
local entry = data[key]
if not entry then
return "Episode not found"
end
local ns, link, title = unpack(entry)
-- If namespace is empty or nil, omit it
if ns == "" or ns == nil then
return string.format("[[%s|%s]]", link, title)
else
return string.format("[[%s:%s|%s]]", ns, link, title)
end
end
return p