Difference between revisions of "Template:Season"

From Stardew Valley Wiki
Jump to navigation Jump to search
(Revamp using new helper templates. Plus handles recursion, takes multiple seasons to create bullet-separated list, etc.)
(More reliable existing-image test; white-space:nowrap because nbsp is not working)
Line 13: Line 13:
  
 
// Check whether there's already a file link in {{{1}}}... implying this is probably a recursive call.  Return immediately
 
// Check whether there's already a file link in {{{1}}}... implying this is probably a recursive call.  Return immediately
-->{{#if:{{#pos:{{{1|}}}|<nowiki>[[File</nowiki>}}|{{{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|}}}|{{#arrayprint:$engl_seasons}}|{{#arrayprint:$lang_seasons}}|default=true}}}}<!--
 
-->{{#arraydefine:$sseason|{{ParseInputValues|{{{1|}}}|{{#arrayprint:$engl_seasons}}|{{#arrayprint:$lang_seasons}}|default=true}}}}<!--
 
-->{{#if:{{#arrayprint:$sseason}} |
 
-->{{#if:{{#arrayprint:$sseason}} |
<span style="display:inline; margin-right:0;"><!--
+
<span style="display:inline; margin-right:0; white-space: nowrap"><!--
 
-->{{#arrayprint:$sseason||@season@|<!--
 
-->{{#arrayprint:$sseason||@season@|<!--
  
 
// Add space and bullet if this is not first entry
 
// Add space and bullet if this is not first entry
-->{{#ifexpr:{{#arraysearch:$sseason|@season@}}>0|&#32;•&#32;}}<!--
+
-->{{#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
 
// Convert @season@ (english page name) into translated page name

Revision as of 04:27, 4 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
Template:ParseInputValues
Template:ParseInputValues
Template:ParseInputValues
Template:ParseInputValues