Template:Category handler/doc: Difference between revisions

Ganaram inukshuk (talk | contribs)
template rating details
Ganaram inukshuk (talk | contribs)
No edit summary
Line 23: Line 23:
: <code><nowiki>{{Category handler | Abstract MOS patterns | 8-tone scales | debug=1 }}</nowiki></code>
: <code><nowiki>{{Category handler | Abstract MOS patterns | 8-tone scales | debug=1 }}</nowiki></code>


disables categories. Typical use as part of another template should instead use something like <code><nowiki>debug={{{debug|}}}</nowiki></code>, so that <code><nowiki>debug=1</nowiki></code> can be added to an instance of that template.
disables categories.


=== Category suppression ===
Typically, this template is used as part of another template, so use something like <code><nowiki>debug={{{debug|}}}</nowiki></code>, so that <code><nowiki>debug=1</nowiki></code> can be added to an instance of that template.


By default, this metatemplate allows categories within the following namespaces: main, file, mediawiki, template, category, and module. Templates placed those namespaces will not categorize those pages.
== Category suppression ==


Additionally, this metatemplate suppresses categories if the page has the following suffixes (subpages): doc or sandbox. This prevents templates from categorizing test or documentation pages, but not if the /doc page is transcluded. This means categorizing templates that categorize other templates will the template's main page, but not their /doc subpages. However, if a categorizing template's documentation is demonstrating its own use, this isn't enough, so adding <code><nowiki>debug=1</nowiki></code> is required to keep categorizing templates from erroneously categorizing themselves.
By default, this metatemplate allows categories within the following namespaces: main, file, mediawiki, template, category, and module. Templates placed within those namespaces will not categorize those pages.


This metatemplate is meant primarily for templates used within those namespaces. Use of this metatemplate is not required for templates with basic categorizing rules, or templates meant to be placed within other namespaces such as the user namespace.
This metatemplate is meant primarily for templates used within those namespaces. Use of this metatemplate is not required for templates with basic categorizing rules, or templates meant to be placed within other namespaces such as the user namespace.
Alternatively, this template can be adjusted to allow or disallow suppression in different namespaces. The example below allows a template to add categories a page within the user namespace, but not templates or modules. Namespaces are delimited using either newlines or semicolons.
<code><nowiki>{{category handler | allowed_ns = user | suppressed_ns = template; module}}</nowiki></code>
Additionally, this metatemplate suppresses categories if the page has the following suffixes (subpages): doc or sandbox. This prevents templates from categorizing test or documentation pages, but not if the /doc page is transcluded. This means categorizing templates that categorize other templates will the template's main page, but not their /doc subpages. However, if a categorizing template's documentation is demonstrating its own use, this isn't enough, so adding <code><nowiki>debug=1</nowiki></code> is required to keep categorizing templates from erroneously categorizing themselves.