Template:Season: Difference between revisions
Appearance
imported>Nebulous Maestress adding size instead of width (standardize params); null alt (always followed by season text) |
imported>Nebulous Maestress new format for list of allowed values; tweaks to parameters |
||
| Line 1: | Line 1: | ||
<includeonly><!-- | <includeonly><!-- | ||
// Define the allowed values | // Define the allowed values, with handling for various quirks/oddities. | ||
// as displayed text | // First column=icon name -> same in all languages | ||
// | // Second column=link (wiki page) name, generally same as displayed text -> needs translation | ||
// All other values are synonyms | |||
// Marriage, Deviations are for sake of NPC schedule sections (and translations) | // Marriage, Deviations are for sake of NPC schedule sections (and translations) | ||
-->{{ | // For 'All Seasons' case, display text doesn't match icon or wiki-link, so | ||
// define default display text in $lang_allseasons, with parameter allowing any other preferred value | |||
-->{{ParseInputValues|code=season|| | |||
,All Seasons Icon, Seasons, All, All Seasons, Any, Always, | |||
,Spring, | |||
,Summer, | |||
,Fall, Fall, Autumn, | |||
,Winter, | |||
,Mermaid's Pendant, Marriage, | |||
,Deviations, | |||
}}{{#arraydefine:$lang_allseasons | All }}<!-- | |||
// END OF translated text | // END OF translated text | ||
| Line 15: | Line 23: | ||
-->{{#if:{{#pos:{{{1|}}}|{{Bracket|2}}File}}|{{{1}}}|<!-- | -->{{#if:{{#pos:{{{1|}}}|{{Bracket|2}}File}}|{{{1}}}|<!-- | ||
// Parse input data, then loop over all extracted entries | // Parse input data, then loop over all extracted entries | ||
-->{{#arraydefine:$sseason|{{ParseInputValues|{{{1|}}}| | -->{{#arraydefine:$sseason|{{ParseInputValues|{{{1|}}}|code=season|default=true}}}}<!-- | ||
-->{{#arrayprint:$sseason||@season@|<!-- | -->{{#arrayprint:$sseason||@season@|<!-- | ||
// | // Convert @season@ (icon name) into translated page name | ||
-->{{# | -->{{#arraydefine:$slink_text|{{ParseInputValues|code=season|@season@|translate=true}}}}<!-- | ||
// | // On first entry, add sort-key if requested. On other entries, add space and bullet. | ||
-->{{# | -->{{#ifexpr:{{#arraysearch:$sseason|@season@}}>0 | ||
| •  | |||
|{{#if:{{{sortkey|}}}| | |||
<span class="sortkey" style="display:none;">{{#if:{{#arrayprint:$slink_text}} | |||
|{{#expr:{{ParseInputValues|code=season|@season@|translate=index}}+1}} | |||
|0}}</span> | |||
}}}}<span style="display:inline; margin-right:0; white-space: nowrap"><!-- | |||
// Display the non-icon, non-linkable cases: | // Display the non-icon, non-linkable cases: Deviations, and unmatched text (detected by empty link_text) | ||
// This is also | // This is also where text_only option is handled | ||
-->{{#ifeq:{{#arrayprint:$slink_text}}| | -->{{#ifeq:{{#arrayprint:$slink_text}}| | ||
| {{ucfirst:@season@}} | | {{ucfirst:@season@}} | ||
| {{#ifexpr: {{#ifeq:@season@|Deviations|1|0}} or {{#if:{{{text_only|}}}|1|0}} | | {{#ifexpr: {{#ifeq:@season@|Deviations|1|0}} or {{#if:{{{text_only|}}}|1|0}} | ||
| {{#if:{{{no_translate|}}}|@season@|{{#arrayprint:$slink_text}}}} | | {{#if:{{{no_translate|}}} | ||
| <!-- | |{{#ifeq:@season@|All Seasons Icon|All|@season@}} | ||
|{{#ifeq:@season@|All Seasons Icon|{{#arrayprint:$lang_allseasons}}|{{#arrayprint:$slink_text}}}}}} | |||
|<!-- | |||
// Display the normal cases: first display icon | // Display the normal cases: first display icon | ||
-->[[File | -->[[File:@season@.png| | ||
{{#if:{{{size|}}}|{{{size}}}px|{{{width|24px}}}}} | link={{#arrayprint:$slink_text}} | alt=]] <!-- | |||
// Add link, with special treatment for text of All Seasons | // Add link, with special treatment for text of All Seasons | ||
-->[[{{#arrayprint:$slink_text}}|<!-- | -->[[{{#arrayprint:$slink_text}}|<!-- | ||
-->{{#ifeq:@season@|Seasons | -->{{#ifeq:@season@|All Seasons Icon | ||
|{{#if:{{{ | |{{#if:{{{all|}}}|{{{all|}}}|{{#arrayprint:$lang_allseasons}}}} | ||
|{{#arrayprint:$slink_text}}}}]]<!-- | |{{#arrayprint:$slink_text}}}}]]<!-- | ||
--> | -->}}}}</span>}}}}</includeonly><noinclude>{{Englishdoc}}{{#ifexist:{{FULLPAGENAME}}/doc |<nowiki/> | ||
{{{{FULLPAGENAME}}/doc}} }}</noinclude> | {{{{FULLPAGENAME}}/doc}} }}</noinclude> | ||
Revision as of 16:51, 10 September 2020
Description
This template displays the icon for the requested season, plus the season as a link to its associated article.
Notes
The template recognizes two special values of season, Marriage and Deviations, for the sake of NPC schedule pages (see Template:ScheduleHeader).
Use
{{Season|name of season|day (optional)|width (optional)}}
Examples
{{Season|Spring}}
{{Season|Marriage}}
{{Season|Deviations}}
{{Season|All|width=48}}
{{Season|Summer|24}}
Results:
Template:ParseInputValues[[File:Template:ParseInputValues.png|
24px | link=Template:ParseInputValues | alt=]] [[Template:ParseInputValues|Template:ParseInputValues]]
Template:ParseInputValues[[File:Template:ParseInputValues.png|
24px | link=Template:ParseInputValues | alt=]] [[Template:ParseInputValues|Template:ParseInputValues]]
Template:ParseInputValues[[File:Template:ParseInputValues.png|
24px | link=Template:ParseInputValues | alt=]] [[Template:ParseInputValues|Template:ParseInputValues]]
Template:ParseInputValues[[File:Template:ParseInputValues.png|
48 | link=Template:ParseInputValues | alt=]] [[Template:ParseInputValues|Template:ParseInputValues]]
Template:ParseInputValues[[File:Template:ParseInputValues.png|
24px | link=Template:ParseInputValues | alt=]] [[Template:ParseInputValues|Template:ParseInputValues]]