打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

本站正在进行早期测试,目前仍存在许多内容的缺失。

模块:Path

来自星砂岛百科

此模块的文档可以在模块:Path/doc创建

local p = {}

function p.main(frame)
    local args = frame:getParent().args
    local currentTitle = mw.title.getCurrentTitle().fullText
    
    -- Create the outer container
    local root = mw.html.create('div'):addClass('ss-path')
    
    -- Create the inner content container and keep a reference to it
    local content = root:tag('div'):addClass('ss-path-content')

    local function addSep(node)
        node:tag('span')
            :addClass('ss-path-sep')
            :wikitext('/')
    end

    -- 1. Add Main Page
    content:wikitext('[[星砂岛百科|首页]]')

    -- 2. Loop through numeric arguments
    local i = 1
    while args[i] do
        local page = mw.text.trim(args[i])
        if page ~= "" then
            addSep(content)
            content:wikitext('[[:' .. page .. ']]')
        end
        i = i + 1
    end

    -- 3. Add Current Page
    addSep(content)
    content:tag('span')
        :addClass('ss-path-current')
        :wikitext(currentTitle)

    return tostring(root)
end

return p