Jump to content

Module:PrettyQuestLink

From Drifters Almanac
Revision as of 20:19, 13 May 2025 by Mildew (talk | contribs) (Created page with "local p = {} function p.pretty(frame) local raw = frame.args[1] or "" raw = mw.text.trim(raw) -- Extract subpage name if in format "Quest/Some Quest" local _, quest = string.match(raw, "^(.-)/(.+)$") local label = quest or raw -- fallback to full name if not a subpage return string.format("%s", raw, label) end return p")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:PrettyQuestLink/doc

local p = {}

function p.pretty(frame)
    local raw = frame.args[1] or ""
    raw = mw.text.trim(raw)

    -- Extract subpage name if in format "Quest/Some Quest"
    local _, quest = string.match(raw, "^(.-)/(.+)$")
    local label = quest or raw  -- fallback to full name if not a subpage

    return string.format("[[%s|%s]]", raw, label)
end

return p