Template:Category series navigation: Difference between revisions
Tom.Reding (talk | contribs) Migrate to Module:Navseasoncats/navhyphen, from sandbox |
Tom.Reding (talk | contribs) Full(ish) Lua implementation, from sandbox & testcases Tag: Replaced |
||
Line 1: | Line 1: | ||
⚫ | |||
<!-- Don't forget to add/remove "/sandbox" to/from below, depending on which way you're copying! --><!-- |
|||
{{Navseasoncats/var pagename}} is a testing variable with a test category name |
|||
{{Navseasoncats/var season}} returns the word containing the year 2015-16 or 2015 |
|||
{{Navseasoncats/var firsthalf}} returns the string before the year-word |
|||
{{Navseasoncats/var lasthalf}} returns the string after the year-word |
|||
--><includeonly>{{#ifexpr: {{str len|{{#invoke:Navseasoncats/var season|var_season|{{{testcase|}}}}}}} > 5 and {{str len|{{#invoke:Navseasoncats/var season|var_season|{{{testcase|}}}}}}} < 10 and ({{#invoke:String|find|{{#invoke:Navseasoncats/var season|var_season|{{{testcase|}}}}}|–}} > 0 or {{#invoke:String|find|{{#invoke:Navseasoncats/var season|var_season|{{{testcase|}}}}}|-}} > 0)<!-- |
|||
-->|{{#invoke:Navseasoncats/navhyphen|navhyphen|{{str left|{{#invoke:Navseasoncats/var season|var_season|{{{testcase|}}}}}|4}}|{{str mid|{{#invoke:Navseasoncats/var season|var_season|{{{testcase|}}}}}|5|1}}|{{str rightc|{{#invoke:Navseasoncats/var season|var_season|{{{testcase|}}}}}|2}}|{{#invoke:Navseasoncats/var firsthalf|var_firsthalf|{{{testcase|}}}}}|{{#invoke:Navseasoncats/var lasthalf|var_lasthalf|{{{testcase|}}}}}}}<!-- |
|||
-->|{{#ifexpr: {{str len|{{#invoke:Navseasoncats/var season|var_season|{{{testcase|}}}}}}} = 4<!-- |
|||
-->|{{#invoke:Navseasoncats/navyear|navyear|{{#invoke:Navseasoncats/var firsthalf|var_firsthalf|{{{testcase|}}}}}|{{str left|{{#invoke:Navseasoncats/var season|var_season|{{{testcase|}}}}}|4}}|{{#invoke:Navseasoncats/var lasthalf|var_lasthalf|{{{testcase|}}}}}|{{{min|}}}|{{{max|}}}}}<!-- |
|||
-->|{{#ifexpr: ({{str len|{{#invoke:Navseasoncats/var season|var_season|{{{testcase|}}}}}}} = 5) and {{#ifeq: {{str mid|{{#invoke:Navseasoncats/var season|var_season|{{{testcase|}}}}}|4|2}} | 0s | 1 | 0}} = 1<!-- |
|||
-->|{{#invoke:Navseasoncats/navdecade|navdecade|{{#invoke:Navseasoncats/var firsthalf|var_firsthalf|{{{testcase|}}}}}|{{str left|{{#invoke:Navseasoncats/var season|var_season|{{{testcase|}}}}}|4}}|{{#invoke:Navseasoncats/var lasthalf|var_lasthalf|{{{testcase|}}}}}|{{str left|{{CURRENTYEAR}}|3}}0}}<!-- |
|||
-->|<nowiki>***Navseasoncats failed to generate navbox***</nowiki>[[Category:Navseasoncats failed to generate navbox]]<!-- |
|||
-->}}<!-- |
|||
-->}}<!-- |
|||
⚫ |
Revision as of 18:00, 12 April 2019
Script error: No such module "Navseasoncats".
This template is used on approximately 522,000 pages, or roughly 1% of all pages. To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This template uses Lua: |
Related pages |
---|
About
{{Category series navigation}} is intended to be a minimal-input, near-universal template for automatically navigating most numerically adjacent categories.
Type | Example category | BC(E)? | Example output |
---|---|---|---|
Season | 2001–02 FA Cup | No | Script error: No such module "Navseasoncats". |
TV season | Futurama season 1 episodes | – | Script error: No such module "Navseasoncats". |
Office term (regular) | MEPs 2004–2009 | No | Script error: No such module "Navseasoncats". |
Office term (irregular) | Wales AMs 2003–2007 | No | Script error: No such module "Navseasoncats". |
Numerical range | Taxonbars with 30–34 taxon IDs | – | |
Decade | 1990s in Scotland | BC | Script error: No such module "Navseasoncats". |
Year | 1999 in Scotland | BC(E) | Script error: No such module "Navseasoncats". |
Year (auto-condensed) | Candidates in the 2000 US presidential election | – | Script error: No such module "Navseasoncats". |
Year (|skip-gaps=yes ) |
Amusement parks opened in 1877 | – | Script error: No such module "Navseasoncats". |
Ordinal (temporal) | 2nd-century rabbis | BC(E) | Script error: No such module "Navseasoncats". |
Ordinal (numeric) | 9th Lok Sabha | – | Script error: No such module "Navseasoncats". |
Ordinal (word) | First Dynasty of Egypt | – | Script error: No such module "Navseasoncats". |
Roman numeral | Deputies of Legislature X of the Kingdom of Italy | – | Script error: No such module "Navseasoncats". |
Mixed decade | 1760s in the Province of Quebec (1763–1791) | – | Script error: No such module "Navseasoncats". |
Mixed year | 1778 establishments in the Province of Quebec (1763–1791) | – | Script error: No such module "Navseasoncats". |
Searching behavior
Most multi-year seasons/office terms/numerical ranges are acceptable, as long as the season duration/term length/range size is <= Script error: No such module "Navseasoncats"., and the gap between seasons is <= Script error: No such module "Navseasoncats".. For series exceeding either of these criteria, see/use {{Irregular category series navigation}}.
The length of each season is automatically determined from the originating category name, up to and including Script error: No such module "Navseasoncats". years. MOS:DATERANGE compliance is preferred, but some deviation is allowed and tracked for regular series with seasons > 1 year long. {{Category redirect}}s are followed, and tracked for either MOS contravention (to be corrected) or for navigational aid (no error). The gap size between successive seasons is also automatically determined, up to and including Script error: No such module "Navseasoncats". years, and defaults to 0 (e.g. 1995–96 → 1996–97).
Automatically condensed years are supported for presidential categories only (but can be easily expanded as needed), for gaps up to and including Script error: No such module "Navseasoncats". years, and defaults to 1. To skip gaps of up to Script error: No such module "Navseasoncats". years in any year categories, use |skip-gaps=yes
.
Limitations
Numerical limitations and AD/BC/E
- Season/office term categories do not work for any years BC, which will be hidden, because no working examples were found.
- Decade categories recognize BC, but not BCE, because no working examples were found.
- Ordinal & numeral words do not work above the ninety-ninth & ninety-nine, because no working examples were found.
Condensation
- Automatically condensed Olympics display is not supported due to peculiarities; use {{Winter Olympics by year category navigation}}, etc., instead.
- Automatically condensed years are supported for US presidential categories only, due to their consistency; use
|skip-gaps=yes
as desired on other year categories. |skip-gaps=yes
currently only works when starting on a year category, and is not intended to find all hyphenated ranges, which allows it to span much larger gaps.
Work-arounds
- Base-name changes: create at least 2 logically numbered {{R from category navigation}} (1 backward & 1 forward), to join both related series.
- Unaccounted-for name+number conventions: where a fixed number is part of the prefix or suffix text, e.g. Chapter 11 bankruptcies, a non-breaking space may force the template to work. See this fix, where {{title year}} skipped over 11 as part of a word rather than a discrete number. (This case has been accounted for and is no longer required in this example.)
- General: for large, permanent gaps† between successive categories, use {{Preceding category}}, {{Category pair}}, {{Succeeding category}}, as needed, in addition to {{Category series navigation}} on both sides, or in the middle, of the gap. Even if {{Category series navigation}} is isolated, it has the benefit of confirming the absence of nearby categories to the reader or maintainer.
†Permanent gaps, where there is a confirmed permanent absence of data, and not just a temporary, yet to be filled, gap on Wikipedia. |skip-gaps=
: create {{R from category navigation}} from an appropriate year to the hyphenated category that was not found.
Related CfDs
- Wikipedia:Categories for discussion/Log/2019 June 8#Category:Northern Ireland MLAs 2016–17
- Wikipedia:Categories for discussion/Log/2019 May 29#Category:MEPs 1952–58
- Wikipedia:Categories for discussion/Log/2019 April 19#Category:Aircraft piston engines 1900–1909
Usage
- Typical usage
{{Category series navigation}}
- Specify a minimum and/or maximum year to display
{{Category series navigation|min=-100}}
{{Category series navigation|min=100 BC}}
{{Category series navigation|min=1753|max=1810}}
{{Category series navigation|max=2030}}
- To skip gaps in year categories
{{Category series navigation|skip-gaps=yes}}
- To not automatically follow {{Category redirect}}s
{{Category series navigation|follow-redirects=no}}
- Exceptional cases
{{Category series navigation|cat=2010s albums}}
— to behave as if placed on|cat=
; consider using {{Category pair}} instead of|cat=
Testing & debugging
To test the output of the template on a particular category name, use the |testcase=
parameter, and |testcasegap=
if necessary:
{{Category series navigation|testcase=1770s in the Province of Quebec (1763–1791)|min=1760}}
→
Script error: No such module "Navseasoncats".
{{Category series navigation|testcase=1770s in the Province of Quebec (1763–1791)|max=1790s}}
→
Script error: No such module "Navseasoncats".
To see all links produced and/or tested, and what effect each has on their display, use |list-all-links=yes
:
{{Category series navigation|testcase=Nations at the 2013 World Athletics Championships|min=2008|skip-gaps=yes|list-all-links=yes}}
→
- Category:Nations at the 2006 World Athletics Championships (2006) ( )
- Category:Nations at the 2007 World Athletics Championships (2007) ( )
- Category:Nations at the 2008 World Athletics Championships (2008)
- Category:Nations at the 2008–2009 World Athletics Championships (2008–2009) (tried; not displayed)2
- Category:Nations at the 2008–09 World Athletics Championships (2008–09) (tried; not displayed)4
- Category:Nations at the 2009 World Athletics Championships → Category:Nations at the 2009 World Championships in Athletics (2009)
- Category:Nations at the 2011 World Athletics Championships → Category:Nations at the 2011 World Championships in Athletics (2011)
- Category:Nations at the 2015 World Athletics Championships → Category:Nations at the 2015 World Championships in Athletics (2015)
- Category:Nations at the 2017 World Athletics Championships → Category:Nations at the 2017 World Championships in Athletics (2017)
- Category:Nations at the 2019 World Athletics Championships (2019)
- Category:Nations at the 2020 World Athletics Championships (2020)
- Category:Nations at the 2020–2021 World Athletics Championships (2020–2021) (tried; not displayed)2
- Category:Nations at the 2020–21 World Athletics Championships (2020–21) (tried; not displayed)4
- Category:Nations at the 2021 World Athletics Championships (2021)
- Category:Nations at the 2021–2022 World Athletics Championships (2021–2022) (tried; not displayed)2
- Category:Nations at the 2021–22 World Athletics Championships (2021–22) (tried; not displayed)4
- All possible element types are shown above (blue, red/grey, hidden, and redirect), and would otherwise display as:
Tracking categories
If the template encounters an issue, it displays an error message and/or places the category into one or more of the following tracking categories:
Maintenance required
- Category:Category series navigation failed to generate navbox (0)
- Category:Category series navigation redirection error (123)
- Category:Category series navigation range abbreviated (MOS) (0)
- Category:Category series navigation range redirected (MOS) (0)
- Category:Category series navigation range ends (blank, MOS) (0)
- Category:Category series navigation range not using en dash (0)
- Category:Category series navigation in mainspace (0)
Maintenance possible
- Category:Category series navigation isolated (1,720)
- Category:Category series navigation default season gap size (129)
- Category:Category series navigation using cat parameter (494)
- Category:Category series navigation using testcase parameter (0)
- Category:Category series navigation using unknown parameter (0)
Module maintenance possible
Tracking only
- Category:Category series navigation range redirected (base change) (322)
- Category:Category series navigation range redirected (var change) (0)
- Category:Category series navigation range redirected (end) (0)
- Category:Category series navigation range gaps (3,352)
- Category:Category series navigation range irregular (730)
- Category:Category series navigation range irregular, 0-length (1,656)
- Category:Category series navigation range ends (present) (9)
- Category:Category series navigation TV season redirected (0)
- Category:Category series navigation decade redirected (7,948)
- Category:Category series navigation year redirected (base change) (2,794)
- Category:Category series navigation year redirected (var change) (79)
- Category:Category series navigation roman numeral redirected (0)
- Category:Category series navigation nordinal redirected (3,779)
- Category:Category series navigation wordinal redirected (9)
- Category:Category series navigation using skip-gaps parameter (291,818)
- Category:Category series navigation year and range (537)
- Category:Category series navigation year and decade (292,430)
- Category:Category series navigation decade and century (47,433)
See also
- {{Irregular category series navigation}}—for use on categories
- {{Irregular series navigation}}—for use outside categories
- {{R from category navigation}}
- {{Category TOC custom}}