模組:沙盒/Cwek/test2

文档图示 模块文档[创建]
local p={}

p.main=function(frame)
	local pFrame1 = frame:getParent()
	local pFrame2 = ( pFrame1~=nil and pFrame1:getParent() ) or nil
	if pFrame1~= nil  then 
		
		local checkNS = frame:preprocess('{{NAMESPACE}}')
		mw.log(checkNS)
		if checkNS=='Template' then 
			return '[[Category:Bar]]'
		else
			return '[[Category:Foo]]'
		end
	else
		mw.log('no Parent')
		return ''
	end
end

return p