Módulo:Mainonly
Documentação do módulo
Esta documentação é transcluída de Predefinição:Sem documentação/doc. [editar] [atualizar]
Este módulo não possui nenhuma documentação. Por favor, considere adicionar uma documentação em Módulo:Mainonly/doc. [editar]
Módulo:Mainonly é solicitado por
.--
-- Module to return text only when invoked in the content namespace
--
local p = {}
function p.main(frame)
local ret = frame:getParent().args[1] or ''
return p._main(ret)
end
function p._main(text)
if mw.title.getCurrentTitle().namespace == 0 then
return text
else
return ''
end
end
--
-- Boolean for whether or not the page is in the mainspace
-- Sometimes it might be better to just check first
-- Rather than spend processing time on something that won't be used
function p.on_main()
return mw.title.getCurrentTitle().namespace == 0
end
return p