Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Link: Difference between revisions

From Teriock
Content deleted Content added
// via Wikitext Extension for VSCode
// via Wikitext Extension for VSCode
Line 28: Line 28:
end
end
return title
return title
end

function p.n ( frame )
local args = frame.args
local ns = args[1]
for _, namespace in ipairs(namespaces) do
if ns == namespace then
return 'true'
end
end
return ''
end
end



Revision as of 03:14, 19 January 2025

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

local p = {}

local namespaces = {
    '',
    'Core',
    'Keyword',
    'Category',
    'Condition',
    'Damage',
    'Drain',
    'Property',
    'Ability',
}

function p.l ( frame )
    local args = frame.args
    local title = args[1]
    for _, namespace in ipairs(namespaces) do
        local fullTitle = namespace == '' and title or (namespace .. ':' .. title)
        local page = mw.title.new(fullTitle)
        if page and page.exists then
            if namespace == 'Category' then
                return ' :' .. fullTitle
            else
                return fullTitle
            end
        end
    end
    return title
end

function p.n ( frame )
    local args = frame.args
    local ns = args[1]
    for _, namespace in ipairs(namespaces) do
        if ns == namespace then
            return 'true'
        end
    end
    return ''
end

return p