Difference between revisions of "Template:Category pair/doc"

From blackwiki
Jump to navigation Jump to search
imported>Tom.Reding
(→‎See also: +{{tl|Navseasoncats}} — for similarly named sequential categories)
imported>Uanfala
(→‎See also: move to navbox)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
{{High-use|19377}}
+
{{High-use|3007}}
 
<!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE -->
 
<!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE -->
 
{{Lua|Module:Check for unknown parameters}}
 
{{Lua|Module:Check for unknown parameters}}
  
 
==Usage==
 
==Usage==
Place
+
Typical usage should be on dissimilar preceding/succeeding categories, or where a large gap exists in otherwise sequential categories. For similarly named sequential categories with gaps less than 5 years, use {{tl|Navseasoncats}} instead.
* {{tlx|Category pair|CATEGORY NAME1|CATEGORY NAME2}}
 
on the top of the category page, replacing "<code>CATEGORY NAMEn</code>" with the ''names only'' of the target categories, leaving out the term "<code>Category:</code>".
 
  
Each category is displayed only if it exists. If neither category exists, nothing will be displayed.
+
* For 2 adjacent categories, a preceding <code>Category:NAME1</code>, and a succeeding <code>Category:NAME2</code>, place:
 +
: {{tlx|Category pair|NAME1|NAME2}}
 +
: at the top of the category page. Each category is displayed only if it exists. If neither category exists, nothing will be displayed.
  
If there is no succeeding category, you may simply place:
+
* If there is no succeeding category, you may simply place:
* {{tlx|Category pair|CATEGORY NAME1}}
+
: {{tlx|Category pair|NAME1}}
on the top of the category page, replacing "<code>CATEGORY NAME1</code>" with the ''name only'' of the target category, leaving out the term "<code>Category:</code>".
+
: at the top of the category page.
  
If there is no preceding category, then leave the first parameter empty, and simply place:
+
* If there is no preceding category, then leave the first parameter empty, and simply place:
* {{tlx|Category pair|<nowiki> </nowiki>|CATEGORY NAME2}}
+
: {{tlx|Category pair|<nowiki></nowiki>|NAME2}}
on the top of the category page, replacing "<code>CATEGORY NAME2</code>" with the ''name only'' of the target category, leaving out the term "<code>Category:</code>".
+
: at the top of the category page.
  
 
==Examples==
 
==Examples==
Line 26: Line 26:
 
* {{tlx|Category pair|1934 FIFA World Cup}} → {{Category pair|1934 FIFA World Cup}}
 
* {{tlx|Category pair|1934 FIFA World Cup}} → {{Category pair|1934 FIFA World Cup}}
  
;Succeding category only, which exists
+
;Succeeding category only, which exists
 
* {{tlx|Category pair|<nowiki></nowiki>|1950 FIFA World Cup}} → {{Category pair||1950 FIFA World Cup}}
 
* {{tlx|Category pair|<nowiki></nowiki>|1950 FIFA World Cup}} → {{Category pair||1950 FIFA World Cup}}
  
Line 39: Line 39:
  
 
== Error checking ==
 
== Error checking ==
If more than two parameters are supplied, a warning message is shown when the page is previewed and when it is saved the page is added to a hidden tracking category: [[:Category:Pages using category pair with more than 2 parameters]].
+
Only the first two parameters are processed, others are ignored.
  
Only the first two parameters are processed. Others are ignored.
+
If more than two parameters are supplied, a warning message is shown when the page is previewed. When it is saved, the page is added to the hidden tracking category: [[:Category:Pages using category pair with more than 2 parameters]].
  
If more than two parameters are supplied, the template is unlikely to do what the editor intended e.g.
+
If more than two parameters are supplied, the template is unlikely to do what the editor intended. For <code>Category:NAME1</code>, <code>Category:NAME2</code>, and <code>Category:NAME3</code>, for example:
* <code><nowiki>{{tlx|Category pair|CATEGORY NAME1|CATEGORY NAME2|CATEGORY NAME3}}</nowiki></code> will ignore CATEGORY NAME3
+
* {{tlc|Category pair|NAME1|NAME2|NAME3}} will ignore <code>Category:NAME3</code>, and
* <code><nowiki>{{tlx|Category pair|CATEGORY NAME1||CATEGORY NAME2}}</nowiki></code> will ignore CATEGORY NAME2, because a duplicate <code>|</code> character between the two categories causes CATEGORY NAME2 to be the third parameter rather the second
+
* {{tlc|Category pair|NAME1||NAME2}} will ignore <code>Category:NAME2</code>, because a duplicate <code>|</code> character between the two categories causes <code>Category:NAME2</code> to be the third parameter rather the second.
  
 
== Tracking categories ==
 
== Tracking categories ==
Line 57: Line 57:
 
* {{tl|Preceding category}}
 
* {{tl|Preceding category}}
 
* {{tl|Succeeding category}}
 
* {{tl|Succeeding category}}
* {{tl|Category see also}}
+
 
* {{tl|Category see also if exists}}
+
{{Category hatnote templates}}
  
 
<includeonly>{{sandbox other||
 
<includeonly>{{sandbox other||

Latest revision as of 15:27, 16 April 2020

Usage

Typical usage should be on dissimilar preceding/succeeding categories, or where a large gap exists in otherwise sequential categories. For similarly named sequential categories with gaps less than 5 years, use {{Navseasoncats}} instead.

  • For 2 adjacent categories, a preceding Category:NAME1, and a succeeding Category:NAME2, place:
{{Category pair|NAME1|NAME2}}
at the top of the category page. Each category is displayed only if it exists. If neither category exists, nothing will be displayed.
  • If there is no succeeding category, you may simply place:
{{Category pair|NAME1}}
at the top of the category page.
  • If there is no preceding category, then leave the first parameter empty, and simply place:
{{Category pair||NAME2}}
at the top of the category page.

Examples

Preceding and succeeding categories, both exist
Preceding category only, which exists
Succeeding category only, which exists
Preceding and succeeding categories, only preceding exists
  • {{Category pair|1934 British Empire Games|1942 British Empire Games}}
Preceding and succeeding categories, only succeeding exists
  • {{Category pair|1946 British Empire Games|1954 British Empire and Commonwealth Games}}
Two non-existent categories, so no output

Error checking

Only the first two parameters are processed, others are ignored.

If more than two parameters are supplied, a warning message is shown when the page is previewed. When it is saved, the page is added to the hidden tracking category: Category:Pages using category pair with more than 2 parameters.

If more than two parameters are supplied, the template is unlikely to do what the editor intended. For Category:NAME1, Category:NAME2, and Category:NAME3, for example:

  • {{Category pair|NAME1|NAME2|NAME3}} will ignore Category:NAME3, and
  • {{Category pair|NAME1||NAME2}} will ignore Category:NAME2, because a duplicate | character between the two categories causes Category:NAME2 to be the third parameter rather the second.

Tracking categories

If neither parameter is a category which currently exists the template will produce no output. This is not necessarily an error; the other categories may simply be part of an incomplete series which will be completed in due course
See above: Error checking

See also