Difference between revisions of "Template:DecadeCategoryNav"

From blackwiki
Jump to navigation Jump to search
imported>Fayenatic london
(→‎Error checking: note on valid exceptions)
imported>Pppery
(Move doc to doc page per edit request)
Line 12: Line 12:
 
-->
 
-->
 
{{#ifeq: {{{topic|}}} | {{#invoke:String|replace|source={{PAGENAME}}|pattern=^%d?%d?%d?0s in|replace=|count=1|plain=false}}  | [[Category:DecadeCategoryNav where topic param = title topic]] | [[Category:DecadeCategoryNav where topic param ≠ title topic]]}}<!--
 
{{#ifeq: {{{topic|}}} | {{#invoke:String|replace|source={{PAGENAME}}|pattern=^%d?%d?%d?0s in|replace=|count=1|plain=false}}  | [[Category:DecadeCategoryNav where topic param = title topic]] | [[Category:DecadeCategoryNav where topic param ≠ title topic]]}}<!--
-->}}</includeonly><noinclude>
+
-->}}</includeonly><noinclude>{{doc}}</noinclude>
{{esoteric}}
 
 
 
== Usage ==
 
<nowiki>{{</nowiki>{{PAGENAME}}|decade=|topic=}}
 
Parameters:
 
* ''decade'' - The first year of the decade to form the "center" of the navigation (e.g. 1980)
 
* ''topic'' - (optional) The topic for the "DECADE in TOPIC" line (e.g. rail transport)
 
Example:
 
<nowiki>{{</nowiki>{{PAGENAME}}|decade=1980|topic=rail transport}}
 
results in:
 
{{{{PAGENAME}}|decade=1980|topic=rail transport}}
 
 
 
== Error checking ==
 
This template should be capable of operating without parameters, by deriving them from the page title.
 
Tracking categories have been set up to test whether there are any valid exceptions:
 
* [[:Category:DecadeCategoryNav where topic param ≠ title topic]] (population: {{PAGESINCATEGORY:DecadeCategoryNav where topic param ≠ title topic}})
 
* [[:Category:DecadeCategoryNav where decade param ≠ title decade]] (population: {{PAGESINCATEGORY:DecadeCategoryNav where decade param ≠ title decade}})
 
 
 
Valid use are tracked at:
 
* [[:Category:DecadeCategoryNav where topic param = title topic]] (population: {{PAGESINCATEGORY:DecadeCategoryNav where topic param = title topic}})
 
* [[:Category:DecadeCategoryNav where decade param = title decade]] (population: {{PAGESINCATEGORY:DecadeCategoryNav where decade param = title decade}})
 
 
 
{{Purge|Purge this page to update the totals.}}
 
 
 
Valid exceptions include cases where the centre decade is intentionally different from the title decade, in order to link both backwards and forwards where there are currently long gaps between decade categories.
 
 
 
[[Category:Works-by-decade templates]]
 
</noinclude>
 

Revision as of 03:20, 23 April 2019

Template documentation[view] [edit] [history] [purge]

Usage

{{DecadeCategoryNav|decade=|topic=}} Parameters:

  • decade - The first year of the decade to form the "center" of the navigation (e.g. 1980)
  • topic - (optional) The topic for the "DECADE in TOPIC" line (e.g. rail transport)

Example: {{DecadeCategoryNav|decade=1980|topic=rail transport}} results in:

Decades in rail transport: 1950s1960s • 1970s1980s1990s2000s2010s
Decades: 1950s1960s1970s1980s1990s2000s2010s

Error checking

This template should be capable of operating without parameters, by deriving them from the page title. Tracking categories have been set up to test whether there are any valid exceptions:

Valid use are tracked at:

Script error: No such module "Purge".

Valid exceptions include cases where the centre decade is intentionally different from the title decade, in order to link both backwards and forwards where there are currently long gaps between decade categories.