Difference between revisions of "Template:Class mask/doc"

From blackwiki
Jump to navigation Jump to search
(+ja)
imported>Redrose64
 
(62 intermediate revisions by 23 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
<includeonly>{{high-risk|1,600,000}}</includeonly>
+
<!-- Place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
+
{{high-use|7476500+|all-pages = yes}}
  
This template is used by [[Template:WPBannerMeta]] to provide the default class masks for WikiProject's quality scales. It also allows the easy implementation of customised class masks for WikiProject bannersm, and is suitable for projects which require a slightly different mask to the default one, and can be used in two different ways:
+
This template is designed for use in WikiProject banners, and provides an easy way to construct a bespoke class mask. The ''class'' parameter must be passed to the template as the first unnamed parameter.
*with {{para|QUALITY_SCALE|subpage}} and placed on the /class subpage of the WikiProject's banner template. In this case, specific guidance on how the template works with the chosen parameters is displayed on this page.
 
*with {{para|QUALITY_SCALE|inline}} and placed directly inside the ''class'' parameter. However this method is ''not'' suitable for projects which use either of the following:
 
**the B-class checklist;
 
**the [[Template:WPBannerMeta/hooks/taskforces|taskforce hook]].
 
  
=== Syntax ===
+
===Implementation in [[Template:WPBannerMeta]]===
Typically this template should be placed on the /class subpage of a WikiProject banner template.
+
The template provides the default class masks for WikiProject's quality scales, and is also used by the majority of projects which use a custom class mask. It can be used in two different ways:
<pre>{{class mask|{{{class|}}}
+
* with {{para|QUALITY_SCALE|subpage}} and placed on the /class subpage of the WikiProject's banner template. In this case, specific guidance on how the template works with the chosen parameters is displayed on this page.
 +
* with {{para|QUALITY_SCALE|inline}} and placed directly inside the ''class'' parameter.
 +
 
 +
=== Use on subpages ===
 +
When used on a /class subpage (e.g. with {{para|QUALITY_SCALE|subpage}}) the template should be called in the following way:
 +
<pre>{{class mask<noinclude>/templatepage</noinclude>|{{{class|}}}
 
  |topic=
 
  |topic=
  |FQS=
+
  |optional parameters
  |forceNA=
+
}}</pre>
|b={{{b|B}}}
+
This allows the [[Template:Class mask/templatepage|/templatepage]] to be displayed which provides useful documentation and category prompts on the subpage.
|category=
+
* the ''topic'' parameter defines the main naming scheme of the assessment categories used by the project and is used to check the existence of the categories that are required. For example, if your project uses categories such as [[:Category:B-Class mathematics articles]], etc. then set {{para|topic|mathematics}}.
|disambig=
+
** if the template uses taskforces, parameters ''topic1'', ''topic2'', ''topic3'', ''topic4'', ''topic5'' and ''topic6'' can be used to check for the necessary categories.
|portal=
+
   
|redirect=
+
Neither of the above are required for the {{para|QUALITY_SCALE|inline}} version.
|template=
+
 
|project=
+
=== Inline use ===
|future=
+
When used "inline" (e.g. with {{para|QUALITY_SCALE|inline}}), the call to /templatepage and the ''topic'' parameters are not required, and the template should be called in the following way:
  |current=
+
<pre>{{class mask |{{{class|}}} |optional parameters }}</pre>
  |needed=
+
Bear in mind that if the banner uses any hooks (e.g. the [[Template:WPBannerMeta/hooks/taskforces|taskforce hook]]), you will need to set the options each time ''class'' is used. Therefore, the subpage method may be more useful in these cases.
  |merge=
+
 
 +
=== Optional parameters ===
 +
*If one or more of these nine is set to <code>no</code>, the class will be switched off. The default is <code>yes</code>:
 +
**{{para|fa}}
 +
**{{para|fl}}
 +
**{{para|a}}
 +
**{{para|ga}}
 +
**{{para|b}}
 +
**{{para|c}}
 +
**{{para|start}}
 +
**{{para|stub}}
 +
**{{para|list}}
 +
* {{para|FQS}} – if set to <code>yes</code>, switches on the following seven additional classes: Category; Disambig; Draft; File; Portal; Project; and Template (FQS stands for Full Quality Scale). Individual classes may then be switched off as desired by setting to <code>no</code>. When {{para|FQS|yes}} is absent, setting one or more to <code>yes</code> will switch on that class.
 +
**{{para|category}}
 +
**{{para|disambig}}
 +
**{{para|draft}}
 +
**{{para|file}}
 +
**{{para|portal}}
 +
**{{para|project}}
 +
**{{para|template}}
 +
*{{para|book}}
 +
*{{para|fm}}
 +
*{{para|redirect}} – if one or more of these three is set to <code>yes</code>, the class will be switched on. The default is <code>no</code> regardless of the {{para|FQS}} setting.
 +
* {{para|forceNA}} - if set to <code>yes</code>, will automatically classify pages tagged as {{para|class|NA}} depending on the namespace of the page. The default setting is <code>no</code>.
 +
* {{para|b1}}, {{para|b2}}, {{para|b3}}, {{para|b4}}, {{para|b5}}, {{para|b6}} - if the B-class checklist is used, these parameters must be passed through.
 +
 
 +
=== The lowercase parameter syntax ===
 +
Add a class in '''lowercase''' as the name of a parameter followed by the value "yes". For example,
 +
 
 +
<pre>|future=yes</pre>
 +
 
 +
would add the Future-class. This is the simplest way of adding a class but has the following two limitations:
 +
 
 +
* The name of the class must have an initial capital letter and all following letters in lowercase. In other words, the capitalisation must be of the form Xxxxxx.
 +
* It is not possible to use this method to add a shortcut or alternative alias for a different class, for example "Cur" for Current-class.
 +
 
 +
If either of these are required, the uppercase parameter syntax must be used (see below).
 +
 
 +
If {{para|FQS|yes}} is used, then a value of "no" may be used to switch off that individual class. Thus, on a /class subpage:
 +
 
 +
<pre>{{class mask<noinclude>/templatepage</noinclude>|{{{class|}}}
 +
  |topic=physics
 +
  |FQS=yes
 +
  |portal=no
 
}}</pre>
 
}}</pre>
  
=== Parameters ===
+
would support six of the seven additional classes listed above and would ''not'' support Portal-class.
* ''topic'' - set this parameter so that the documentation on the /class subpage links to the WikiProject's quality categories, e.g. if your quality categories are of the form [[:Category:B-Class mathematics articles]], etc. then set {{para|topic|mathematics}}.
+
 
* ''class'' - this parameter must be passed as the first unnamed parameter in all cases.
+
=== The UPPERCASE parameter syntax ===
* ''FQS'' - if set to "yes", switches on the six additional classes Category, Disambig, Image, Portal, Template & Project. Individual classes may then be switched off by their respective parameters to "no".
+
Add a class in '''uppercase''' as the name of a parameter followed by the ''exact name'' of the class (including the required case) as the value of the parameter. For example,
* ''forceNA'' - if set to "yes", will automatically classify pages tagged as {{para|class|NA}} depending on the namespace of the page. The default setting is "no".
+
 
* ''category'', ''disambig'', ''portal'', ''redirect'', ''template'', ''project'', ''future'', ''current'', ''needed'', ''merge'' - if set to "yes", enables this quality class. The default for each is "no", unless ''FQS'' is set.
+
<pre>|SIA=SIA</pre>
* ''b'' - if the B-class checklist is used, this parameter must be passed through.
+
 
 +
would add SIA-class and
 +
 
 +
<pre>|CHEESECAKE=CheeseCake</pre>
 +
 
 +
would add CheeseCake-class.
 +
 
 +
You can use this method to add a shortcut or alias for a class. For example,
 +
 
 +
<pre>|future=yes
 +
|FUT=Future</pre>
 +
 
 +
would have the effect that an input of either "future" or "fut" (not case sensitive) would result in Future-class.
 +
 
 +
You can add as many aliases for a class as needed, so for SIA-class:
 +
 
 +
<pre>|SIA=SIA
 +
|SETINDEX=SIA
 +
|SET INDEX ARTICLE=SIA</pre>
 +
 
 +
would mean that an input of "sia", "setindex" or "set index article" (again, not case senstitve) would each result in SIA-class.
  
 
=== Example 1: subpage ===
 
=== Example 1: subpage ===
 
The following code is placed in the banner template:
 
The following code is placed in the banner template:
 
<pre>
 
<pre>
|QUALITY_SCALE = subpage
+
|QUALITY_SCALE=subpage
  |class = {{{class|}}}
+
  |class={{{class|}}}
 
</pre>
 
</pre>
 
and on the /class subpage (for example [[Template:WikiProject Zimbabwe]] uses the subpage [[Template:WikiProject Zimbabwe/class]]), the following code is used:
 
and on the /class subpage (for example [[Template:WikiProject Zimbabwe]] uses the subpage [[Template:WikiProject Zimbabwe/class]]), the following code is used:
 
<pre>
 
<pre>
{{class mask | {{{class|}}}
+
{{class mask<noinclude>/templatepage</noinclude>|{{{class|}}}
 
  |topic=Zimbabwe
 
  |topic=Zimbabwe
 
  |FQS=yes
 
  |FQS=yes
Line 54: Line 118:
 
=== Example 2: inline ===
 
=== Example 2: inline ===
 
The following code is placed in the banner template:
 
The following code is placed in the banner template:
 +
 
<pre>
 
<pre>
 
|QUALITY_SCALE = inline
 
|QUALITY_SCALE = inline
  |class = {{class mask | {{{class|}}} | category=yes }}
+
  |class={{class mask |{{{class|}}} |FQS=yes |redirect=yes |fm=yes}}
 
</pre>
 
</pre>
Now the standard quality classes are used, plus the additional Category-class.
 
*Reminder: this method is not suitable is the template uses the B-class checklist or the taskforce hook.
 
  
=== Subpages ===
+
Now the extended quality classes are used, plus the additional Redirect and FM classes.
* [[Template:Class mask/core]] - the class mask itself
+
 
* [[Template:Class mask/extended]] -  a version with the extended scale hard-wired, for use by [[Template:WPBannerMeta/class]]
+
=== Subtemplates ===
* [[Template:Class mask/sandbox]] - the template sandbox, used for experimentation
+
* [[Template:Class mask/b|/b]] - the mask for B-checklist parameters
* [[Template:Class mask/table]] - the documentation that is displayed on /class subpages
+
* [[Template:Class mask/sandbox|/sandbox]] - the template sandbox, used for experimentation
** [[Template:Class mask/row]] - used by /table
+
* [[Template:Class mask/templatepage|/templatepage]] - the documentation that is displayed on /class subpages
* [[Template:Class mask/doc]] - the documentation you are reading now
+
** [[Template:Class mask/templatepage/row|/templatepage/row]] - used by /templatepage
 +
* [[Template:Class mask/doc|/doc]] - the documentation you are reading now
 +
** [[Template:Class mask/doc/custom|/doc/custom]] - for information on building your own class mask
  
 
=== Uses ===
 
=== Uses ===
* [{{fullurl:Special:WhatLinksHere/Template:Class mask/table|&hidelinks=1&hideredirs=1}} This] shows all /class subpages which use this template.
+
* [{{fullurl:Special:WhatLinksHere/Template:Class mask/templatepage|&hidelinks=1&hideredirs=1}} This] shows all /class subpages which use this template.
<includeonly>
+
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
+
<includeonly>{{Sandbox other||
[[ja:Template:Class mask]]
+
<!-- Categories below this line, please; interwikis at Wikidata -->
</includeonly>
+
[[Category:WikiProject templates]]
 +
[[Category:Wikipedia metatemplates]]
 +
 
 +
}}</includeonly>

Latest revision as of 20:37, 20 October 2020

This template is designed for use in WikiProject banners, and provides an easy way to construct a bespoke class mask. The class parameter must be passed to the template as the first unnamed parameter.

Implementation in Template:WPBannerMeta

The template provides the default class masks for WikiProject's quality scales, and is also used by the majority of projects which use a custom class mask. It can be used in two different ways:

  • with |QUALITY_SCALE=subpage and placed on the /class subpage of the WikiProject's banner template. In this case, specific guidance on how the template works with the chosen parameters is displayed on this page.
  • with |QUALITY_SCALE=inline and placed directly inside the class parameter.

Use on subpages

When used on a /class subpage (e.g. with |QUALITY_SCALE=subpage) the template should be called in the following way:

{{class mask<noinclude>/templatepage</noinclude>|{{{class|}}}
 |topic=
 |optional parameters
}}

This allows the /templatepage to be displayed which provides useful documentation and category prompts on the subpage.

  • the topic parameter defines the main naming scheme of the assessment categories used by the project and is used to check the existence of the categories that are required. For example, if your project uses categories such as Category:B-Class mathematics articles, etc. then set |topic=mathematics.
    • if the template uses taskforces, parameters topic1, topic2, topic3, topic4, topic5 and topic6 can be used to check for the necessary categories.

Neither of the above are required for the |QUALITY_SCALE=inline version.

Inline use

When used "inline" (e.g. with |QUALITY_SCALE=inline), the call to /templatepage and the topic parameters are not required, and the template should be called in the following way:

{{class mask |{{{class|}}} |optional parameters }}

Bear in mind that if the banner uses any hooks (e.g. the taskforce hook), you will need to set the options each time class is used. Therefore, the subpage method may be more useful in these cases.

Optional parameters

  • If one or more of these nine is set to no, the class will be switched off. The default is yes:
    • |fa=
    • |fl=
    • |a=
    • |ga=
    • |b=
    • |c=
    • |start=
    • |stub=
    • |list=
  • |FQS= – if set to yes, switches on the following seven additional classes: Category; Disambig; Draft; File; Portal; Project; and Template (FQS stands for Full Quality Scale). Individual classes may then be switched off as desired by setting to no. When |FQS=yes is absent, setting one or more to yes will switch on that class.
    • |category=
    • |disambig=
    • |draft=
    • |file=
    • |portal=
    • |project=
    • |template=
  • |book=
  • |fm=
  • |redirect= – if one or more of these three is set to yes, the class will be switched on. The default is no regardless of the |FQS= setting.
  • |forceNA= - if set to yes, will automatically classify pages tagged as |class=NA depending on the namespace of the page. The default setting is no.
  • |b1=, |b2=, |b3=, |b4=, |b5=, |b6= - if the B-class checklist is used, these parameters must be passed through.

The lowercase parameter syntax

Add a class in lowercase as the name of a parameter followed by the value "yes". For example,

|future=yes

would add the Future-class. This is the simplest way of adding a class but has the following two limitations:

  • The name of the class must have an initial capital letter and all following letters in lowercase. In other words, the capitalisation must be of the form Xxxxxx.
  • It is not possible to use this method to add a shortcut or alternative alias for a different class, for example "Cur" for Current-class.

If either of these are required, the uppercase parameter syntax must be used (see below).

If |FQS=yes is used, then a value of "no" may be used to switch off that individual class. Thus, on a /class subpage:

{{class mask<noinclude>/templatepage</noinclude>|{{{class|}}}
 |topic=physics
 |FQS=yes
 |portal=no
}}

would support six of the seven additional classes listed above and would not support Portal-class.

The UPPERCASE parameter syntax

Add a class in uppercase as the name of a parameter followed by the exact name of the class (including the required case) as the value of the parameter. For example,

|SIA=SIA

would add SIA-class and

|CHEESECAKE=CheeseCake

would add CheeseCake-class.

You can use this method to add a shortcut or alias for a class. For example,

|future=yes
|FUT=Future

would have the effect that an input of either "future" or "fut" (not case sensitive) would result in Future-class.

You can add as many aliases for a class as needed, so for SIA-class:

|SIA=SIA
|SETINDEX=SIA
|SET INDEX ARTICLE=SIA

would mean that an input of "sia", "setindex" or "set index article" (again, not case senstitve) would each result in SIA-class.

Example 1: subpage

The following code is placed in the banner template:

|QUALITY_SCALE=subpage
 |class={{{class|}}}

and on the /class subpage (for example Template:WikiProject Zimbabwe uses the subpage Template:WikiProject Zimbabwe/class), the following code is used:

{{class mask<noinclude>/templatepage</noinclude>|{{{class|}}}
 |topic=Zimbabwe
 |FQS=yes
 |redirect=yes
}}

In this case all six of the "extended" quality classes are used, plus the additional Redirect-class. Because the |topic= parameter is set, specific documentation will be displayed on the /class subpage.

Example 2: inline

The following code is placed in the banner template:

|QUALITY_SCALE = inline
 |class={{class mask |{{{class|}}} |FQS=yes |redirect=yes |fm=yes}}

Now the extended quality classes are used, plus the additional Redirect and FM classes.

Subtemplates

  • /b - the mask for B-checklist parameters
  • /sandbox - the template sandbox, used for experimentation
  • /templatepage - the documentation that is displayed on /class subpages
  • /doc - the documentation you are reading now
    • /doc/custom - for information on building your own class mask

Uses

  • This shows all /class subpages which use this template.