Jump to content

Template:Season: Difference between revisions

From Stardew Valley Wiki
imported>Nebulous Maestress
More reliable existing-image test; white-space:nowrap because nbsp is not working
imported>Margotbean
m Reverted edits by IBugOne (talk) to last revision by Margotbean
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly><!--
<includeonly><span style="display:inline; margin-right:0;">{{#switch: {{lc:{{{1}}}}}
 
|1|01|spring|[[spring]] = [[File:Spring.png|{{{width|24px}}}|link=]]{{#if:{{{2|}}}|&thinsp;{{{2|}}}}}&nbsp;[[Spring]]
// Define the allowed values.  Handling multiple quirks/oddities.  Ideally, all of the names would work equally well
|2|02|summer|[[summer]] = [[File:Summer.png|{{{width|24px}}}|link=]]{{#if:{{{2|}}}|&thinsp;{{{2|}}}}}&nbsp;[[Summer]]
// as displayed text, wiki page names, and icon names.  But that's not possible.  So top priority is to
|3|03|fall|autumn|[[fall]]|[[autumn]] = [[File:Fall.png|{{{width|24px}}}|link=]]{{#if:{{{2|}}}|&thinsp;{{{2|}}}}}&nbsp;[[Fall]]
// create a list of valid page names.  That's why 'Seasons' is primary name for 'All', 'Any', 'All Seasons'
|4|04|winter|[[winter]] = [[File:Winter.png|{{{width|24px}}}|link=]]{{#if:{{{2|}}}|&thinsp;{{{2|}}}}}&nbsp;[[Winter]]
// Marriage, Deviations are for sake of NPC schedule sections (and translations)
|marriage|[[marriage]] = [[File:Mermaid's Pendant.png|{{{width|24px}}}|link=]]&nbsp;[[Marriage]]
-->{{#arraydefine:$engl_seasons|Spring, Summer, Fall, Winter, Seasons, Marriage, Deviations, Fall, Seasons, Seasons}}<!--
|deviations = Deviations
-->{{#arraydefine:$lang_seasons|Spring, Summer, Fall, Winter, Seasons, Marriage, Deviations, Autumn, All, Any}}<!--
|5|05|all|any = [[File:All Seasons Icon.png|{{{width|24px}}}|link=]]&nbsp;[[Seasons|All]]
-->{{#arraydefine:$lang_allshort | All }}<!--
|#default = {{ucfirst:{{{1|}}} }} }}</span></includeonly><noinclude>{{{{FULLPAGENAME}}/doc}}</noinclude>
-->{{#arraydefine:$lang_alllong  | All Seasons}}<!--
 
// END OF translated text
 
// Check whether there's already a file link in {{{1}}}... implying this is probably a recursive call.  Return immediately
-->{{#if:{{#pos:{{{1|}}}|{{Bracket|2}}File}}|{{{1}}}|<!--
// Parse input data, then loop over all extracted entries
-->{{#arraydefine:$sseason|{{ParseInputValues|{{{1|}}}|{{#arrayprint:$engl_seasons}}|{{#arrayprint:$lang_seasons}}|default=true}}}}<!--
-->{{#if:{{#arrayprint:$sseason}} |
<span style="display:inline; margin-right:0; white-space: nowrap"><!--
-->{{#arrayprint:$sseason||@season@|<!--
 
// Add space and bullet if this is not first entry
-->{{#ifexpr:{{#arraysearch:$sseason|@season@}}>0|</span>&#32;•&#32;<span style="display:inline; margin-right:0; white-space: nowrap">}}<!--
 
// Convert @season@ (english page name) into translated page name
-->{{#arraydefine:$slink_text|{{#arrayindex:$lang_seasons|{{#arraysearch:$engl_seasons|@season@}}}}}}<!--
 
// Display the non-icon, non-linkable cases: Devations, and unmatched text (detected by empty link_text)
// This is also how text_only option is handled
-->{{#ifeq:{{#arrayprint:$slink_text}}|
    | {{ucfirst:@season@}}
    | {{#ifexpr: {{#ifeq:@season@|Deviations|1|0}} or {{#if:{{{text_only|}}}|1|0}}
        | {{#if:{{{no_translate|}}}|@season@|{{#arrayprint:$slink_text}}}}
| <!--
 
// Display the normal cases: first display icon
-->[[File:{{#switch:@season@
      |Spring
      |Summer
      |Fall
      |Winter     = @season@
      |Seasons    = All_Seasons_Icon
      |Marriage  = Mermaid's Pendant
  }}.png | {{{width|24px}}} | link={{#arrayprint:$slink_text}} | alt={{#arrayprint:$slink_text}}]]&nbsp;<!--
 
// Add link, with special treatment for text of All Seasons
-->[[{{#arrayprint:$slink_text}}|<!--
-->{{#ifeq:@season@|Seasons
      |{{#if:{{{do_short|}}}|{{#arrayprint:$lang_allshort}}|{{#arrayprint:$lang_alllong}}}}
      |{{#arrayprint:$slink_text}}}}]]<!--
-->}}}}}}</span>}}}}</includeonly><noinclude>{{Englishdoc}}{{#ifexist:{{FULLPAGENAME}}/doc |<nowiki/>
{{{{FULLPAGENAME}}/doc}} }}</noinclude>

Latest revision as of 05:16, 23 June 2024

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:
 Spring
 Marriage
Deviations
48 All
 24 Summer