Template:Suppress categories
| This template uses Lua: |
This template strips categories from wikitext. For example, if passed the code "foo[[Category:Some category]]", it will return only "foo". It can be used to strip categories from templates as well; if passed the code "{{my template}}", it will return the template output minus the categories.
The template properly handles categories escaped with the colon trick, categories whose names include invalid characters such as ">", and categories that are surrounded with nowiki tags. However, it does not support complex wikitext such as nested links or magic words like __TOC__. Even so, it should still remove the vast majority of categories from any given wikitext.
Usage[edit]
{{suppress categories|input text}}
This template implements a version of the functionality provided by the HTML <pre> tag.
Usage[edit]
This template supports two parameters
|width= The width of the pre "box"
|space= The way white space is handled in the pre "box"
| Markup | Renders as |
|---|---|
{{Pre|
This Pre-format
can look
like this.
}}
|
Template loop detected: Template:Pre |
Main differences include:
- It wraps text that overflows the page.
- It allows mid-line-breaks (but not always consistently).
Main limitations include:
- If the text is a single long word, it won't be wrapped and will still break out to the right hand of the page.
- HTML and wikimarkup aren't disabled as in
<pre>...</pre>and are rendered as usual (thus if a parameter contains any wikimarkup, enclose it in<nowiki>...</nowiki>); however, multiple spaces are preserved.
As with <pre> and <code>, {{pre}} displays text in the font specified as the monospace font in the user's browser options, or specified in the user's CSS pages.
Example[edit]
Markup
{{Pre|
'''First line, markup working:''' and HTML comment <!--HIDDEN--> hidden.
'''Second line, long text wrapping:''' all work and no play make jack a dull boy all work and no play make jack a dull boy all work and no play make jack a dull boy all work and no play make jack a dull boy all work and no play make jack a dull boy.
'''Third line with raw | pipe is handled''', but the space before the pipe is lost. Up to raw 20 pipes are handled, else use <nowiki>{{!}}</nowiki> and {{!}} it's {{!}} OK.
'''Fourth line, multiple spaces preserved''' unlike in HTML and wikitext.
'''Fifth line, following the previous one'''.
'''Last line''' preceded by two blank lines in markup and in display.
}}
- Result
Template loop detected: Template:Pre
See also[edit]
- {{pre2}}, a template with similar functionality but induces optional line wrap and optional scroll bars.
<syntaxhighlight><pre>
Examples[edit]
| Code | Output | ||
|---|---|---|---|
{{suppress categories|foo}}
|
foo | ||
{{suppress categories|foo[[Category:Some category]]}}
|
foo | ||
{{suppress categories|foo[[Category:Some category]]bar[[Category:Another category]]}}
|
foobar | ||
{{suppress categories|foo{{{some_parameter|[[Category:Bar]]}}}}}
|
foo | ||
{{suppress categories|foo[[Category:Bad ca[]tegory link]]}}
|
foo[[Category:Bad ca[]tegory link]] | ||
{{suppress categories|foo[[:Category:Colon trick]]}}
|
fooCategory:Colon trick | ||
{{suppress categories|foo[[Category:Piped link|bar]]}}
|
foo | ||
{{suppress categories|foo[[Category:Piped link|ba[]r]]}}
|
foo | ||
{{suppress categories|foo[[non-category link]]}}
|
foonon-category link | ||
{{suppress categories|foo[[ Category : Some category with spaces ]]}}
|
foo | ||
{{suppress categories|{{User alternative account name|Example}}}}
|
|
See also[edit]
| The above documentation is transcluded from Template:Suppress categories/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |