Template:CritterMonths/doc

This template may be used in critter tables (e.g. Fish/New Horizons) to display which months a critter is available. The purpose of this template is to avoid editors having to write HTML formatting themselves to achieve the desired effect; it also allows us to easily change the way we display month data, if ever desired.

Usage
The first parameter is to define the critter type.
 * : Can be  or  . This sets the color for highlighted months.

There are two ways to input month data. You cannot mix both methods in the same template call.

The first way to define months is through start/end month parameters. This method reads left to right and cannot circle back from December. This means that if a fish is available November through March, you need to define it as follows:
 * : The first month that a critter is available (, , etc.)
 * : The last month that a critter is available (, , etc.)
 * If there are two periods that a critter is available, /  and  /  may be defined as well.

The second way is through defining individual months with parameters named,  , etc. This method requires you to define every month parameter, but only input text (e.g.  ) for the months you want to highlight. Example:

Examples
Fish from November through March:

Bug from November through March:

Fish from April through July:

Fish only in December:

Bug all year round:

Technical
Th template source is not the prettiest. It also resides on one line, due to new lines causing formatting issues within tables.

While the code looks long, the base logic is actually fairly simple:
 * If  or   is set to , add the following, which sets a color and bolds any following text:


 * Insert the letter for the corresponding month (for January, that is )
 * If  or   is set to , close the span with
 * Repeat for each of the following months.