Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Suppress categories/doc: Difference between revisions

Template page
fix
use TemplateData
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{Lua|Module:Suppress categories}}
{{TemplateBox
{{TemplateBox
   |1        = 1
   |1        = 1
   |1d-en   = The input text.
   |1label-en= input text
  |1type    = content
   |1stat    = required
   |1stat    = required


Line 8: Line 10:


The template properly handles categories escaped with the [[w:en:Help:Colon trick|colon trick]], categories whose names include invalid characters such as "<code>></code>", and categories that are surrounded with [[w:en:WP:NOWIKI|nowiki]] tags. However, it does not support complex wikitext such as nested links or [[w:en:WP:MAGIC|magic words]] like <code><nowiki>__TOC__</nowiki></code>. Even so, it should still remove the vast majority of categories from any given wikitext.
The template properly handles categories escaped with the [[w:en:Help:Colon trick|colon trick]], categories whose names include invalid characters such as "<code>></code>", and categories that are surrounded with [[w:en:WP:NOWIKI|nowiki]] tags. However, it does not support complex wikitext such as nested links or [[w:en:WP:MAGIC|magic words]] like <code><nowiki>__TOC__</nowiki></code>. Even so, it should still remove the vast majority of categories from any given wikitext.
    |desc-td-en      = This template strips categories from wikitext. For example, if passed the code "<nowiki>foo[[Category:Some category]]</nowiki>", it will return only "foo". It can be used to strip categories from templates as well; if passed the code "<nowiki>{{my template}}</nowiki>", it will return the template output minus the categories.
   |example            = <nowiki>foo[[Category:Piped link|bar]]</nowiki>
   |example            = <nowiki>foo[[Category:Piped link|bar]]</nowiki>
   |example-value      = {{suppress categories|foo[[Category:Piped link|bar]]}}
   |example-value      = {{suppress categories|foo[[Category:Piped link|bar]]}}
   |namespace          = all
   |namespace          = all
   |usergroup          = all
   |usergroup          = all
  |useTemplateData    = only
}}
}}

Latest revision as of 16:21, 31 December 2023

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

{{Suppress categories |1= }}

Template parameters

<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.


Wikipedia's help about TemplateDataCommons-specific information

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.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
input text1

Contentrequired

Additional information

The template is intended to be used in the following namespaces: all namespaces

The template is intended to be used by the following user groups: all users

Example

{{Suppress categories|foo[[Category:Piped link|bar]]}}

renders as:

foo

Cookies help us deliver our services. By using our services, you agree to our use of cookies.