Modul:GetParentPageLink
Erscheinungsbild
Die Dokumentation für dieses Modul kann unter Modul:GetParentPageLink/Doku erstellt werden
local p = {}
function p.get(frame)
local title = mw.title.getCurrentTitle().text
local parts = mw.text.split(title, "/")
if #parts <= 1 then return "" end
local parentParts = mw.clone(parts)
local label = parentParts[#parentParts - 1]
table.remove(parentParts)
local parentPage = table.concat(parentParts, "/")
local namespace = mw.title.getCurrentTitle().nsText
if namespace ~= "" then
parentPage = namespace .. ":" .. parentPage
end
return string.format("[[%s|%s]]", parentPage, label)
end
return p