模組:沙盒/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