模組:沙盒/Cwek/test

local p={}

p.main=function(frame)
	local pFrame1 = frame:getParent()
	local pFrame2 = ( pFrame1~=nil and pFrame1:getParent() ) or nil
	if pFrame1~= nil and pFrame2~=nil then 
		mw.log(pFrame2:getTitle())
		local pTitle = mw.title.new(pFrame2:getTitle())
		if(pTitle.namespace==10) then
			return '[[Category:Bar]]'
		else
			return '[[Category:Foo]]'
		end
	else
		mw.log('no Parent')
		return ''
	end
end

return p