Jump to content

Module:SingleLink

From Drifters Almanac
Revision as of 19:17, 8 May 2025 by Mildew (talk | contribs) (Created page with "local p = {} function p.fromNotation(frame) local raw = frame.args[1] or "" local parts = mw.text.split(raw, "::") local target = mw.text.trim(parts[1]) local label = parts[2] and mw.text.trim(parts[2]) or target if target == "" then return "" end return string.format('%s', target, label) end return p")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local p = {}

function p.fromNotation(frame)
    local raw = frame.args[1] or ""
    local parts = mw.text.split(raw, "::")
    local target = mw.text.trim(parts[1])
    local label = parts[2] and mw.text.trim(parts[2]) or target

    if target == "" then
        return ""
    end

    return string.format('[[%s|%s]]', target, label)
end

return p