Modül:Namespace detect
Emits certain content only when transcluded from the main or category namespace. This ensures that certain categories and magic words are only applied where necessary, and not, for example, on user sandboxes or template documentation pages.
namespace_detect.main(frame)(function)- Only emits the passed wikitext if the current page is an article or category.
- Parameter:
frameScribunto's frame object (table) - Returns: Passed wikitext if article or category, nothing otherwise (string)
--- Emits certain content only when transcluded from the main or category
-- namespace. This ensures that certain categories and magic words are only
-- applied where necessary, and not, for example, on user sandboxes or template
-- documentation pages.
-- @module namespace_detect
-- @alias p
-- <nowiki>
local p = {}
--- Only emits the passed wikitext if the current page is an article or
-- category.
-- @function p.main
-- @param {table} frame Scribunto's frame object
-- @returns {string} Passed wikitext if article or category, nothing
-- otherwise
function p.main(frame)
if mw.title.getCurrentTitle():inNamespaces(0, 14) then
return frame.args[1]
end
end
return p
-- </nowiki>