模块:Path
来自卡厄思梦境WIKI
此模块的文档可以在模块:Path/doc创建
local p = {}
function p.main(frame)
local args = frame:getParent().args
local currentPage = mw.title.getCurrentTitle().text
local root = mw.html.create('div')
:addClass('path-breadcrumb')
root:node(
mw.html.create('span')
:addClass('path-breadcrumb__item')
:wikitext('[[首页]]')
)
for _, v in ipairs(args) do
v = mw.text.trim(v)
if v ~= '' then
root:node(
mw.html.create('span')
:addClass('path-breadcrumb__separator')
:wikitext('/')
)
root:node(
mw.html.create('span')
:addClass('path-breadcrumb__item')
:wikitext('[[' .. v .. ']]')
)
end
end
root:node(
mw.html.create('span')
:addClass('path-breadcrumb__separator')
:wikitext('/')
)
root:node(
mw.html.create('span')
:addClass('path-breadcrumb__item path-breadcrumb__item--current')
:wikitext(currentPage)
)
return tostring(root)
end
return p