Difference between revisions of "Template:Enumeration"
Dinoguy1000 (talk | contribs) (document all the parameters in a comment to (theoretically) make editing easier (some of the details are probably wrong though)) |
Dinoguy1000 (talk | contribs) (require current card name to be passed in explicitly) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | <!-- | |
− | 1 = Name of property that stores the card numbers, used to fetch the names of the prev/next card | + | 1 = Name of property that stores the card numbers, used to fetch the names of the prev/next card, defaults to "Card number" |
2 = Current card's number (first of its numbers if it has multiple numbers) | 2 = Current card's number (first of its numbers if it has multiple numbers) | ||
3 = (optional) Current card's last number, if it has multiple numbers | 3 = (optional) Current card's last number, if it has multiple numbers | ||
pad = (optional) Number of digits to pad the card number to, defaults to 3 (e.g. 001, 048) | pad = (optional) Number of digits to pad the card number to, defaults to 3 (e.g. 001, 048) | ||
first = (optional) First card's number, defaults to 1 | first = (optional) First card's number, defaults to 1 | ||
− | padded = (optional) Queries prev/next cards using the padded number instead of the unpadded one (useful if the numbers are stored as strings) | + | padded = (optional) Queries prev/next cards using the padded number instead of the unpadded one (useful if the numbers are stored as strings), used by default if property is "Card number" |
last = Last card's number | last = Last card's number | ||
curr = Content to be shown in the middle section, normally includes things like links to video game, card list, and card gallery | curr = Content to be shown in the middle section, normally includes things like links to video game, card list, and card gallery | ||
curr2 = Set to "none" to disable showing the current card's name/number here, otherwise if it's set the input is shown instead of the current number | curr2 = Set to "none" to disable showing the current card's name/number here, otherwise if it's set the input is shown instead of the current number | ||
curr2_full = Raw curr2 output | curr2_full = Raw curr2 output | ||
− | name = Name of the current card | + | name = Name of the current card |
− | -->{{ #vardefine: $ | + | -->{{ #vardefine: $enumeration_query | {{ #if: {{{1|}}} | {{ ucfirst: {{{1}}} }} | Card number }} }}<!-- |
− | + | -->{{ #vardefine: $enumeration_padded | {{ #if: {{{padded|}}} | 1 | {{ #ifeq: {{ #var: $enumeration_query }} | Card number | 1 }} }} }}<!-- | |
− | -->{{ #vardefine: $ | ||
− | -->{{ #vardefine: $ | + | -->{{ #vardefine: $enumeration_curr_number | {{ #expr: {{{2|}}} }} }}<!-- |
− | -->{{ #vardefine: $ | + | -->{{ #vardefine: $enumeration_prev_number | {{ #expr: {{{2|}}} - 1 }} }}<!-- |
− | -->{{ #vardefine: $ | + | -->{{ #vardefine: $enumeration_next_number | {{ #expr: {{ #if: {{{3|}}} | {{{3}}} | {{{2|}}} }} + 1 }} }}<!-- |
+ | -->{{ #if: {{ #var: $enumeration_padded }} | ||
+ | | {{ #vardefine: $enumeration_padding | {{ #if: {{{pad|}}} | {{{pad}}} | 3 }} }}<!-- | ||
+ | -->{{ #vardefine: $enumeration_curr_number | {{ padleft: {{ #var: $enumeration_curr_number }} | {{ #var: $enumeration_padding }} | 0 }} }}<!-- | ||
+ | -->{{ #vardefine: $enumeration_prev_number | {{ padleft: {{ #var: $enumeration_prev_number }} | {{ #var: $enumeration_padding }} | 0 }} }}<!-- | ||
+ | -->{{ #vardefine: $enumeration_next_number | {{ padleft: {{ #var: $enumeration_next_number }} | {{ #var: $enumeration_padding }} | 0 }} }} | ||
+ | }}<!-- | ||
− | -->{{ #iferror: {{ #var: $ | + | -->{{ #vardefine: $enumeration_release | {{ #if: {{{release|}}} | {{{release}}} | {{ #var: $release }} }} }}<!-- |
+ | |||
+ | -->{{ #iferror: {{ #var: $enumeration_curr_number }} | ||
| | | | ||
| <div class="chronology" lang="{{ #var: $ln | en }}"> | | <div class="chronology" lang="{{ #var: $ln | en }}"> | ||
− | {{ #if: {{ | + | {{ #if: {{{2|}}} |
− | | {{ #ifexpr: {{ #var: $ | + | | {{ #ifexpr: {{ #var: $enumeration_curr_number }} = 0{{{first|1}}} |
| | | | ||
− | | <div class="prev">#{{ #var: $ | + | | <div class="prev">#{{ #var: $enumeration_prev_number }}: <!-- |
--><span class="quotes"><!-- | --><span class="quotes"><!-- | ||
− | -->{{ #ask: | + | -->{{ #ask: {{ #if: {{ #var: $enumeration_release }} | [[{{ #if: {{{subobjects|}}} | -Has subobject. }}Release::{{ #var: $enumeration_release }}]] }}[[{{ #var: $enumeration_query }}::{{ #var: $enumeration_prev_number }}]] |
− | |?{{#var: $lang | English }} name | + | |?{{ #if: {{{subobjects|}}} | -Has subobject. }}{{ #var: $lang | English }} name |
| format = template | | format = template | ||
| link = none | | link = none | ||
Line 37: | Line 44: | ||
--></span> | --></span> | ||
</div> | </div> | ||
− | }}{{ #ifexpr: {{ #var: $ | + | }}{{ #ifexpr: {{ #var: $enumeration_curr_number }} = 0{{{last|100}}} |
| | | | ||
− | | <div class="next">#{{ #var: $ | + | | <div class="next">#{{ #var: $enumeration_next_number }}: <!-- |
--><span class="quotes"><!-- | --><span class="quotes"><!-- | ||
− | -->{{ #ask: | + | -->{{ #ask: {{ #if: {{ #var: $enumeration_release }} | [[{{ #if: {{{subobjects|}}} | -Has subobject. }}Release::{{ #var: $enumeration_release }}]] }}[[{{ #var: $enumeration_query }}::{{ #var: $enumeration_next_number }}]] |
− | |?{{#var: $lang | English }} name | + | |?{{ #if: {{{subobjects|}}} | -Has subobject. }}{{ #var: $lang | English }} name |
| format = template | | format = template | ||
| link = none | | link = none | ||
Line 52: | Line 59: | ||
}} | }} | ||
}} | }} | ||
− | <div class="curr">{{{curr|}}}{{ #ifeq: {{ lc: {{{curr2}}} }} | none || {{ #if: {{{curr|}}} | <br /> }}{{ #if: {{{curr2_full|}}} | {{{curr2_full}}} | {{{curr2|}}} {{pound}}{{ #var: $ | + | <div class="curr">{{{curr|}}}{{ #ifeq: {{ lc: {{{curr2}}} }} | none || {{ #if: {{{curr|}}} | <br /> }}{{ #if: {{{curr2_full|}}} | {{{curr2_full}}} | {{{curr2|}}} {{pound}}{{ #var: $enumeration_curr_number }}: <span class="quotes">{{{name}}}</span> }} }}</div> |
</div><noinclude>{{documentation}}</noinclude> | </div><noinclude>{{documentation}}</noinclude> |
Latest revision as of 19:45, 15 March 2024
#000: {{{name}}}
{{Enumeration}}
is for use in templates using {{card table}}
, where it can be used to create previous and next links through numbered cards.
Usage[edit]
{{Enumeration|property|number|number2|first=|last=|curr=|pad=}}
Mandatory parameters:
- property: The first unnamed parameter. This should be the Semantic MediaWiki property, which stores the cards' numbers.
- number: The second unnamed parameter. This should be the number of the current card. If the card has multiple sequential numbers, use the first.
Optional parameters:
- number2: The third unnamed parameter. If the card has multiple sequential numbers, this should be the last of those numbers.
- first: The number of the first card in the sequence. If unused, this defaults to 1. If left blank, it becomes 0.
- last: The number of the last card in the sequence. If unused, this defaults to 100. If left blank, it becomes 0.
- curr: Content to go in the middle "current" section
- pad: The amount of zero-padding to use. This defaults to 3, but leaving it blank, will cause it to become 0.
If this template is used in a non-English tab, the variables $lang
and $ln
should have been created to store the language name and ISO 639-1 code, respectively. If so this will change the language the cards' name appears in and the style of quotation marks used around the name.