Jump to content

Module:PrettyQuestLink: Difference between revisions

From Drifters Almanac
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"
 
m Protected "Module:PrettyQuestLink" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
 
(No difference)

Latest revision as of 20:19, 13 May 2025

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