Jump to content

Module:User:Mr. Stradivarius/Parent title

From Wikipedia, the free encyclopedia

-- This module returns the title of the parent frame, if it is in the template
-- namespace.

local p = {}

function p.main(frame)
	local parent = frame:getParent()
	if not parent then
		return nil
	end
	local title = mw.title.new(parent:getTitle())
	if title.namespace == 10 then
		return title.text
	else
		return nil
	end
end

return p