Difference between revisions of "Template:Module rating"

From "PTTLink Wiki"
Jump to navigation Jump to search
Mediawiki>ExE Boss
(Add error message when module rating is invalid or not specified (match mw:Template:Module rating))
m (1 revision imported)
Line 1: Line 1:
<includeonly>{{#ifeq:{{{demospace|{{NAMESPACE}} }}}|{{ns:Module}}|{{ombox
+
<noinclude>
| lang      = {{Fallback|Module rating/i18n}}
+
<languages />
  | type      = {{#switch: {{{1|}}}
+
</noinclude><includeonly>{{Module other|{{ombox
  | pre-alpha | prealpha | pa
+
  | type      = notice
  | sandbox | s
 
  | alpha | a
 
  | beta | b
 
  | release | r | general | g
 
  | semiprotected | semiprotect | semi
 
  | protected | protect | p = notice
 
  | #default = serious
 
}}
 
 
  | image    = {{#switch: {{{1|}}}
 
  | image    = {{#switch: {{{1|}}}
   | pre-alpha | prealpha | pa         = [[File:Ambox warning blue construction.svg|40x40px|link=]]
+
   | pre-alpha | prealpha | pa = [[File:OOjs UI icon text-style.svg|40x40px|link=]]
  | sandbox | s                        = [[File:Sandbox.svg|40x40px|link=]]
+
   | alpha | a                 = [[File:OOjs UI icon bold-a.svg|40x40px|link=]]
   | alpha | a                         = [[File:Alpha lowercase.svg|26x26px|link=]]
+
   | beta | b                 = [[File:OOjs UI icon bold-b.svg|40x40px|link=]]
   | beta | b                           = [[File:Greek lc beta.svg|40x40px|link=]]
+
   | release | r | general | g = [[File:OOjs UI icon check-constructive.svg|40x40px|link=]]
   | release | r | general | g         = [[File:Green check.svg|40x40px|link=]]
+
   | protected | protect | p   = [[File:{{#if:{{CASCADINGSOURCES:{{FULLPAGENAME}}}}|Cascade-protection-shackle.svg|{{#ifeq:{{PROTECTIONLEVEL:edit}}|sysop|Full-protection-shackle-red.svg|Semi-protection-shackle-no-text.svg}}}}|40x40px|link=]]
   | protected | protect | p           = [[File:{{#switch:{{#invoke:Effective protection level|edit|{{#switch:{{SUBPAGENAME}}|doc|sandbox={{FULLBASEPAGENAME}}|{{FULLPAGENAME}}}}}}|autoconfirmed=Semi-protection-shackle|accountcreator|templateeditor=Template-protection-shackle-brackets 2|sysop|#default=Full-protection-shackle-block}}.svg|40x40px|link=|alt=Protected]]
 
 
   | semiprotected | semiprotect | semi = [[File:Semi-protection-shackle.svg|40x40px|link=]]
 
   | semiprotected | semiprotect | semi = [[File:Semi-protection-shackle.svg|40x40px|link=]]
   | #default                           = [[File:Ambox warning.svg|40x40px|link=]]
+
   | #default = [[File:OOjs UI icon alert-destructive.svg|40x40px|link=]]
 
   }}
 
   }}
 +
| style    =
 
  | textstyle =  
 
  | textstyle =  
 
  | text      = {{#switch: {{{1|}}}
 
  | text      = {{#switch: {{{1|}}}
    | pre-alpha | prealpha | pa         = {{autotranslate|base=Module rating/i18n|pre-alpha}}
+
  | pre-alpha | prealpha | pa = <translate><!--T:1--> This module is rated as [[<tvar name=1>Special:MyLanguage/Category:Modules in pre-alpha development</tvar>|pre-alpha]].</translate> <translate><!--T:2--> It is unfinished, and may or may not be in active development.</translate> <translate><!--T:3--> It should not be used from article namespace pages.</translate> <translate><!--T:4--> Modules remain pre-alpha until the original editor (or someone who takes one over if it is abandoned for some time) is satisfied with the basic structure.</translate><!--
    | sandbox | s                        = Sandbox: {{autotranslate|base=Module rating/i18n|pre-alpha}}
+
  -->{{#ifexpr:
    | alpha | a                         = {{autotranslate|base=Module rating/i18n|alpha }}
+
        <!-- No category for /doc or /sandbox subpages -->
    | beta | b                           = {{autotranslate|base=Module rating/i18n|beta}}
+
        {{IsDocSubpage|false=0}} or {{#ifeq:{{SUBPAGENAME}}|sandbox|1|0}}
    | release | r | general | g          = {{autotranslate|base=Module rating/i18n|release }}
+
      || {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules in pre-alpha development|{{PAGENAME}}]] }}
    | semiprotected | semiprotect | semi = {{autotranslate|base=Module rating/i18n|semiprotected }}
+
      }}
    | protected | protect | p           = {{autotranslate|base=Module rating/i18n|protected }}
+
  | alpha | a                 = <translate><!--T:20--> This module is rated as [[<tvar name=1>Special:MyLanguage/Category:Modules in alpha</tvar>|alpha]].</translate> <translate><!--T:21--> It is ready for third party input, and may be used on a few pages to see if problems arise, but should be watched.</translate> <translate><!--T:22--> Suggestions for new features or changes in their input and output mechanisms are welcome.</translate><!--
    | #default = {{error|message={{autotranslate|base=Module rating/i18n|invalid-rating}}}}
+
  -->{{#ifexpr:
  }}
+
        <!-- No category for /doc or /sandbox subpages -->
| style    = {{#switch: {{{1|}}}
+
        {{IsDocSubpage|false=0}} or {{#ifeq:{{SUBPAGENAME}}|sandbox|1|0}}
    | release | r | general | g
+
      || {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules in alpha|{{PAGENAME}}]] }}
    | semiprotected | semiprotect | semi
+
      }}
    | protected | protect | p  = background:#f9fff3;<!-- ;border:2px solid #8F8 -->
+
  | beta | b                 = <translate><!--T:23--> This module is rated as [[<tvar name=1>Special:MyLanguage/Category:Modules in beta</tvar>|beta]], and is ready for widespread use.</translate> <translate><!--T:24--> It is still new and should be used with some caution to ensure the results are as expected.</translate><!--
 +
  -->{{#ifexpr:
 +
        <!-- No category for /doc or /sandbox subpages -->
 +
        {{IsDocSubpage|false=0}} or {{#ifeq:{{SUBPAGENAME}}|sandbox|1|0}}
 +
      || {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules in beta|{{PAGENAME}}]] }}
 +
      }}
 +
  | release | r | general | g = <translate><!--T:25--> This module is rated as [[<tvar name=1>Special:MyLanguage/Category:Modules for general use</tvar>|ready for general use]].</translate> <translate><!--T:26--> It has reached a mature form and is thought to be bug-free and ready for use wherever appropriate.</translate> <translate><!--T:27--> It is ready to mention on help pages and other resources as an option for new users to learn.</translate> <translate><!--T:28--> To reduce server load and bad output, it should be improved by [[w:WP:TESTCASES|sandbox testing]] rather than repeated trial-and-error editing.</translate><!--
 +
  -->{{#ifexpr:
 +
         <!-- No category for /doc or /sandbox subpages -->
 +
        {{IsDocSubpage|false=0}} or {{#ifeq:{{SUBPAGENAME}}|sandbox|1|0}}
 +
      || {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules for general use|{{PAGENAME}}]] }}
 +
      }}
 +
  | protected | protect | p   = <translate><!--T:29--> This module is [[<tvar name=1>Special:MyLanguage/Category:Modules subject to page protection</tvar>|subject to {{<tvar name=2>#if:{{CASCADINGSOURCES:{{FULLPAGENAME}}}}</tvar>|cascading|page}} protection]].</translate> <translate><!--T:30--> It is a highly visible module in use by a very large number of pages.</translate> <translate><!--T:31--> Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is [[<tvar name=1>Special:MyLanguage/Project:Protected page</tvar>|protected]] from editing.</translate><!--
 +
  -->{{#ifexpr:
 +
        <!-- No category for /doc or /sandbox subpages -->
 +
        {{IsDocSubpage|false=0}} or {{#ifeq:{{SUBPAGENAME}}|sandbox|1|0}}
 +
      || {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | [[Category:Modules subject to page protection|{{PAGENAME}}]] }}
 +
      }}
 +
  | #default                  = {{error|1=<translate><!--T:17--> Module rating is invalid or not specified.</translate>}}
 
   }}
 
   }}
}} <!-- End of ombox -->
+
}}|{{error|1=<translate><!--T:18--> Error:</translate> <translate><!--T:19--> <tvar name=1>{{tl|Module rating}}</tvar> must be placed in the Module namespace.</translate>}}|demospace={{{demospace|<noinclude>module</noinclude>}}}}}</includeonly><noinclude>
{{#switch: {{SUBPAGENAME}}|doc|sandbox=<!-- No category for /doc or /sandbox subpages -->
+
{{documentation|content=
  | {{#ifeq: {{{nocat|}}} | true | <!-- No category if user sets nocat=true --> | {{#switch: {{{1|}}}
+
 
    | pre-alpha | prealpha | pa = [[Category:Modules in pre-alpha development]]
+
<translate><!--T:5--> This template is used to rate [[Lua/Overview|Lua modules]] by quality.</translate>
    | sandbox | s              = [[Category:Scribunto module sandboxes]]
+
<translate><!--T:6--> It is placed at the top of the module's /doc subpage.</translate>
    | alpha | a                = [[Category:Modules in alpha]]
+
<translate><!--T:7--> It produces a message informing users about the rating system, and it also places the module into a tracking category.</translate>
    | beta | b                  = [[Category:Modules in beta]]
+
 
    | release | r | general | g = [[Category:Modules for general use]]
+
<translate>
    | semiprotected | semiprotect | semi
+
== Usage == <!--T:8-->
    | protected | protect | p  = [[Category:Modules subject to page protection]]
+
 
  }} }}
+
<!--T:9-->
}}|{{error|message={{autotranslate|base=Module rating/i18n|error}} }} |demospace={{{demospace|}}}}}</includeonly><noinclude>
+
Basic usage:
{{module rating|release|nocat=true|demospace=Module}}
+
</translate>
{{documentation}}
+
{{pre|{{tlx|module rating|''rating''}}}}
<!-- Categories go on the /doc subpage, and interwikis go in Wikidata. -->
+
 
 +
<translate><!--T:10--> Without categories:</translate>
 +
{{pre|{{tlx|module rating|''rating''|3=nocat=true}}}}
 +
 
 +
<translate><!--T:32--> If <tvar name=1>{{tlx|Module rating}}</tvar> is used outside the Module namespace, an error message is shown: <tvar name=2>{{module rating}}</tvar></translate>
 +
 
 +
<translate>
 +
== Ratings == <!--T:11-->
 +
</translate>
 +
<translate><!--T:33--> The rating should be placed in the first positional parameter.</translate>
 +
<translate><!--T:34--> There are five different ratings: <tvar name=1>'''pre-alpha'''{{int|comma-separator}}'''alpha'''{{int|comma-separator}}'''beta'''{{int|comma-separator}}'''release'''{{int|and}}{{int|word-separator}}'''protected'''</tvar>.</translate>
 +
<translate><!--T:35--> There are also short alias codes for each of the ratings.</translate>
 +
 
 +
{{(!}} class="wikitable"
 +
! <translate><!--T:12--> Rating</translate>
 +
! <translate><!--T:13--> Aliases</translate>
 +
! <translate><!--T:14--> Result</translate>
 +
{{!}}-
 +
{{!}} <code>pre-alpha</code>
 +
{{!}} <code>prealpha</code><br/><code>pa</code>
 +
{{!}} {{module rating|pre-alpha|nocat=true|demospace=Module}}
 +
{{!}}-
 +
{{!}} <code>alpha</code>
 +
{{!}} <code>a</code>
 +
{{!}} {{module rating|alpha|nocat=true|demospace=module}}
 +
{{!}}-
 +
{{!}} <code>beta</code>
 +
{{!}} <code>b</code>
 +
{{!}} {{module rating|beta|nocat=true|demospace=module}}
 +
{{!}}-
 +
{{!}} <code>release</code>
 +
{{!}} <code>r</code><br/><code>general</code><br/><code>g</code>
 +
{{!}} {{module rating|release|nocat=true|demospace=module}}
 +
{{!}}-
 +
{{!}} <code>protected</code>
 +
{{!}} <code>protect</code><br/><code>p</code>
 +
{{!}} {{module rating|protected|nocat=true|demospace=module}}
 +
{{!}}-
 +
{{!}} <translate><!--T:36--> ''Anything else or if missing''</translate>
 +
{{!}}
 +
{{!}} {{module rating|prdaskidkated|nocat=true|demospace=module}}
 +
{{!}}-
 +
{{!)}}
 +
 
 +
== TemplateData ==
 +
{{Module rating/doc}}
 +
 
 +
<translate>
 +
== Categories == <!--T:15-->
 +
 
 +
<!--T:37-->
 +
The template will put modules in one of the following categories, according to the rating specified:
 +
</translate>
 +
 
 +
* {{ll|Category:Modules in pre-alpha development}}
 +
* {{ll|Category:Modules in alpha}}
 +
* {{ll|Category:Modules in beta}}
 +
* {{ll|Category:Modules for general use}}
 +
* {{ll|Category:Modules subject to page protection}}
 +
 
 +
<translate><!--T:38--> These categories are suppressed on pages ending with /doc.</translate>
 +
<translate><!--T:39--> To suppress categories on all pages, you can use the code <tvar name=1>{{para|nocat|true}}</tvar>.</translate>
 +
 
 +
<translate>
 +
== See also == <!--T:16-->
 +
</translate>
 +
* {{tl|module-rating categories}}
 +
* [[Lua]]
 +
* {{tl|Lua}}
 +
 
 +
}}
 
</noinclude>
 
</noinclude>

Revision as of 17:58, 5 September 2021

<languages />

Template documentationpurge ]

<translate> This template is used to rate Lua modules by quality.</translate> <translate> It is placed at the top of the module's /doc subpage.</translate> <translate> It produces a message informing users about the rating system, and it also places the module into a tracking category.</translate>

<translate>

Usage

Basic usage: </translate>

{{module rating|rating}}

<translate> Without categories:</translate>

{{module rating|rating|nocat=true}}

<translate> If <tvar name=1>{{Module rating}}</tvar> is used outside the Module namespace, an error message is shown: <tvar name=2><translate> Error:</translate> <translate> <tvar name=1>{{Module rating}}</tvar> must be placed in the Module namespace.</translate></tvar></translate>

<translate>

Ratings

</translate> <translate> The rating should be placed in the first positional parameter.</translate> <translate> There are five different ratings: <tvar name=1>pre-alpha, alpha, beta, release and protected</tvar>.</translate> <translate> There are also short alias codes for each of the ratings.</translate>

<translate> Rating</translate> <translate> Aliases</translate> <translate> Result</translate>
pre-alpha prealpha
pa
alpha a
beta b
release r
general
g
protected protect
p
<translate> Anything else or if missing</translate>

TemplateData

Template:Module rating/doc

<translate>

Categories

The template will put modules in one of the following categories, according to the rating specified: </translate>

<translate> These categories are suppressed on pages ending with /doc.</translate> <translate> To suppress categories on all pages, you can use the code <tvar name=1>|nocat=true</tvar>.</translate>

<translate>

See also

</translate>