Jump to content

Module:Episode

From Semantic Stargate Wiki
Revision as of 17:04, 21 July 2025 by LIMAFOX76 (talk | contribs)
Documentation icon Module documentation[create]
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