Difference between revisions of "User:Becasita/SubPages/Templates/ProcessRarities"

From Yugipedia
Jump to: navigation, search
m (Fallback to Common.)
(Updating links.)
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{ #arraydefine: @RARITIES | {{{1|Common}}} | ,
+
{{ #arraydefine: @RARITIES | {{ #if: {{{1|}}} | {{{1}}} | Common }} | , }}{{
}}{{ #vardefine: $COUNTER | 0
+
  #arrayprint: @RARITIES
}}{{ #if: {{ #arrayindex: @RARITIES | {{ #var: $COUNTER }} }} | [[{{ R | {{ #arrayindex: @RARITIES | {{ #var: $COUNTER }} }} | full=yes }}]]
+
    | {{ #switch: {{ lc: {{{space|}}} }} | left | both = <nowiki/> }} {{
}}{{ #if: {{ #arrayindex: @RARITIES | {{ #vardefineecho: $COUNTER | {{ #expr: {{ #var: $COUNTER }} + 1 }} }} }} | <br />[[{{ R | {{ #arrayindex: @RARITIES | {{ #var: $COUNTER }} }} | full=yes }}]]
+
          #if: {{{2|}}} | {{{2}}} | <br /> }} {{
}}{{ #if: {{ #arrayindex: @RARITIES | {{ #vardefineecho: $COUNTER | {{ #expr: {{ #var: $COUNTER }} + 1 }} }} }} | <br />[[{{ R | {{ #arrayindex: @RARITIES | {{ #var: $COUNTER }} }} | full=yes }}]]
+
          #switch: {{ lc: {{{space|}}} }} | right | both = <nowiki/> }}
}}{{ #if: {{ #arrayindex: @RARITIES | {{ #vardefineecho: $COUNTER | {{ #expr: {{ #var: $COUNTER }} + 1 }} }} }} | <br />[[{{ R | {{ #arrayindex: @RARITIES | {{ #var: $COUNTER }} }} | full=yes }}]]
+
    | @RARITIES-PART
}}{{ #if: {{ #arrayindex: @RARITIES | {{ #vardefineecho: $COUNTER | {{ #expr: {{ #var: $COUNTER }} + 1 }} }} }} | <br />[[{{ R | {{ #arrayindex: @RARITIES | {{ #var: $COUNTER }} }} | full=yes }}]] }}<noinclude>
+
    | {{ #vardefine: $RARITY | {{r|@RARITIES-PART|full=yes}} }}{{ #if: {{ #var: $RARITY }} | {{ #vardefine: $RARITY-ABBR | {{ #if: {{{abbr|}}} | {{r|@RARITIES-PART}} }} }} {{
 +
          #switch: {{ lc: {{{link|}}} }}
 +
            | no | none | off | false | 0 = {{ #var: $RARITY-ABBR | {{ #var: $RARITY }} }}
 +
            | #default = [[{{ #var: $RARITY }}|{{ #var: $RARITY-ABBR | {{ #var: $RARITY }} }}]]
 +
          }} }}
 +
}}<noinclude>
  
 
==Usage==
 
==Usage==
{{tlx|:User:Becasita/SubPages/Templates/SetList/Row/ProcessRarities|Rarities}}
+
{{tlx|:User:Becasita/SubPages/Templates/ProcessRarities|''&lt;Rarities>''|''&lt;Separator>''|abbr|space|link}}
  
Receives one parameter as a list of rarities, divided by a comma <code>,</code>. To a maximum of 5 rarities.<br />
+
Receives a list of rarities. By default, it will print them with their full terminology, linked, one in each line.
It outputs the rarities with their full terminology, one per line. Not case sensitive.
+
 
 +
;Receives two unnamed parameter:
 +
:'''1''': A list of rarities separated by a comma (<code>,</code>). Not case sensitive (see {{Tn|R}} for more info). Defaults to <code>[[Common]]</code>.
 +
:'''2''': A separator. In case there are two or more rarities, they will be outputted separated by the argument given to this parameter. Optional parameter.
 +
 
 +
;Receives three named parameters:
 +
:'''abbr''': By default, the rarities are outputted with their full terminology (e.g., <code>[[Super Rare]]</code>); If this parameter is filled (with, for instance <code>1</code> or <code>yes</code>), the rarities will be outputted abbreviated (e.g., <code>[[SR]]</code>). Optional parameter.
 +
:'''space''': By default, there will be no spaces around the delimiter; This optional parameter serves to add said space. There are three possible keywords for this parameter:
 +
:*<code>left</code>, which will add a space at the left of the delimiter;
 +
:*<code>right</code>, which will add a space at the right of the delimiter;
 +
:*<code>both</code>, which will add a space at both the left and the right of the delimiter.
 +
:'''link''': If set to <code>no</code> / <code>none</code> / <code>off</code> / <code>false</code> / <code>0</code>, the rarities will not be linked when outputted. Optional.
 +
 
 +
===Examples===
 +
{| class="wikitable"
 +
|-
 +
! scope="row" | Input
 +
| <nowiki>{{:User:Becasita/SubPages/Templates/ProcessRarities|C, r, sCR, utr}}</nowiki>
 +
|-
 +
! scope="row" | Output
 +
| {{:User:Becasita/SubPages/Templates/ProcessRarities|C, r, sCR, utr}}
 +
|-
 +
|}
 +
 
 +
{| class="wikitable"
 +
|-
 +
! scope="row" | Input
 +
| <nowiki>{{:User:Becasita/SubPages/Templates/ProcessRarities| UPR, DNPR | / | space=both }}</nowiki>
 +
|-
 +
! scope="row" | Output
 +
| {{:User:Becasita/SubPages/Templates/ProcessRarities| UPR , DNPR | / | space=both }}
 +
|-
 +
|}
 +
 
 +
{| class="wikitable"
 +
|-
 +
! scope="row" | Input
 +
| <nowiki>{{:User:Becasita/SubPages/Templates/ProcessRarities| GScR, SP | , | space=right }}</nowiki>
 +
|-
 +
! scope="row" | Output
 +
| {{:User:Becasita/SubPages/Templates/ProcessRarities| GScR, SP | , | space=right }}
 +
|-
 +
|}
  
===Example===
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! scope="row" | Input
 
! scope="row" | Input
| {{tlx|:User:Becasita/SubPages/Templates/SetList/Row/ProcessRarities|C,r,sCR,utr}}
+
| <nowiki>{{:User:Becasita/SubPages/Templates/ProcessRarities| Normal Rare, Not a rarity, PlScR | ;<br /> | abbr=yes }}</nowiki>
 
|-
 
|-
 
! scope="row" | Output
 
! scope="row" | Output
| {{:User:Becasita/SubPages/Templates/SetList/Row/ProcessRarities|C,r,sCR,utr}}
+
| {{:User:Becasita/SubPages/Templates/ProcessRarities| Normal Rare, Not a rarity, PlScR | ;<br /> | abbr=yes }}
 
|-
 
|-
 
|}
 
|}
  
</noinclude>
+
{| class="wikitable"
 +
|-
 +
! scope="row" | Input
 +
| <nowiki>{{:User:Becasita/SubPages/Templates/ProcessRarities| C, SP, SSP | or | space=both | link = none }}</nowiki>
 +
|-
 +
! scope="row" | Output
 +
| {{:User:Becasita/SubPages/Templates/ProcessRarities| C, SP, SSP | or | space=both | link = none }}
 +
|-
 +
|}</noinclude>

Latest revision as of 19:35, 17 October 2016

[[[1]|[1]]]

Usage[edit]

{{User:Becasita/SubPages/Templates/ProcessRarities|<Rarities>|<Separator>|abbr|space|link}}

Receives a list of rarities. By default, it will print them with their full terminology, linked, one in each line.

Receives two unnamed parameter
1: A list of rarities separated by a comma (,). Not case sensitive (see {{R}} for more info). Defaults to Common.
2: A separator. In case there are two or more rarities, they will be outputted separated by the argument given to this parameter. Optional parameter.
Receives three named parameters
abbr: By default, the rarities are outputted with their full terminology (e.g., Super Rare); If this parameter is filled (with, for instance 1 or yes), the rarities will be outputted abbreviated (e.g., SR). Optional parameter.
space: By default, there will be no spaces around the delimiter; This optional parameter serves to add said space. There are three possible keywords for this parameter:
  • left, which will add a space at the left of the delimiter;
  • right, which will add a space at the right of the delimiter;
  • both, which will add a space at both the left and the right of the delimiter.
link: If set to no / none / off / false / 0, the rarities will not be linked when outputted. Optional.

Examples[edit]

Input {{:User:Becasita/SubPages/Templates/ProcessRarities|C, r, sCR, utr}}
Output [[[2]|[2]]]
[[[3]|[3]]]
[[[4]|[4]]]
[[[5]|[5]]]
Input {{:User:Becasita/SubPages/Templates/ProcessRarities| UPR, DNPR | / | space=both }}
Output [[[6]|[6]]] / [[[7]|[7]]]
Input {{:User:Becasita/SubPages/Templates/ProcessRarities| GScR, SP | , | space=right }}
Output [[[8]|[8]]], [[[9]|[9]]]
Input {{:User:Becasita/SubPages/Templates/ProcessRarities| Normal Rare, Not a rarity, PlScR | ;<br /> | abbr=yes }}
Output [[[10]|[10]]];
[[[11]|[11]]];
[[[12]|[12]]]
Input {{:User:Becasita/SubPages/Templates/ProcessRarities| C, SP, SSP | or | space=both | link = none }}
Output [2] or [9] or [13]
  1. Cite error: Invalid <ref> tag; no text was provided for refs named Common
  2. a b Cite error: Invalid <ref> tag; no text was provided for refs named C
  3. Cite error: Invalid <ref> tag; no text was provided for refs named r
  4. Cite error: Invalid <ref> tag; no text was provided for refs named sCR
  5. Cite error: Invalid <ref> tag; no text was provided for refs named utr
  6. Cite error: Invalid <ref> tag; no text was provided for refs named UPR
  7. Cite error: Invalid <ref> tag; no text was provided for refs named DNPR
  8. Cite error: Invalid <ref> tag; no text was provided for refs named GScR
  9. a b Cite error: Invalid <ref> tag; no text was provided for refs named SP
  10. a b Cite error: Invalid <ref> tag; no text was provided for refs named Normal Rare
  11. a b Cite error: Invalid <ref> tag; no text was provided for refs named Not a rarity
  12. a b Cite error: Invalid <ref> tag; no text was provided for refs named PlScR
  13. Cite error: Invalid <ref> tag; no text was provided for refs named SSP