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

From blackwiki
Jump to navigation Jump to search
imported>Tom.Reding
m (→‎Error checking: Fix redcat)
imported>Tom.Reding
(→‎Examples: Better examples - all former examples are now better served by {{Navseasoncats}})
Line 21: Line 21:
 
==Examples==
 
==Examples==
 
;Preceding and succeeding categories, both exist
 
;Preceding and succeeding categories, both exist
* {{tlx|Category pair|19th century|21st century}} → {{Category pair|19th century|21st century}}
+
* {{tlx|Category pair|1934 FIFA World Cup|1950 FIFA World Cup}} → {{Category pair|1934 FIFA World Cup|1950 FIFA World Cup}}
* {{tlx|Category pair|20th century|22nd century}} → {{Category pair|20th century|22nd century}}
+
 
 
;Preceding category only, which exists
 
;Preceding category only, which exists
* {{tlx|Category pair|20th century}} → {{Category pair|20th century}}
+
* {{tlx|Category pair|1934 FIFA World Cup}} → {{Category pair|1934 FIFA World Cup}}
 +
 
 
;Succeding category only, which exists
 
;Succeding category only, which exists
* {{tlx|Category pair|<nowiki></nowiki>|5th century}} → {{Category pair||5th century}}
+
* {{tlx|Category pair|<nowiki></nowiki>|1950 FIFA World Cup}} → {{Category pair||1950 FIFA World Cup}}
 +
 
 
;Preceding and succeeding categories, only preceding exists
 
;Preceding and succeeding categories, only preceding exists
* {{tlx|Category pair|7th century|Nth century}} → {{Category pair|7th century|Nth century}}
+
* {{tlx|Category pair|1934 British Empire Games|1942 British Empire Games}} → {{Category pair|1934 British Empire Games|1942 British Empire Games}}
 +
 
 
;Preceding and succeeding categories, only succeeding exists
 
;Preceding and succeeding categories, only succeeding exists
* {{tlx|Category pair|Xth century|5th century}} → {{Category pair|Xth century|5th century}}
+
* {{tlx|Category pair|1946 British Empire Games|1954 British Empire and Commonwealth Games}} → {{Category pair|1946 British Empire Games|1954 British Empire and Commonwealth Games}}
 +
 
 
; Two non-existent categories, so no output:
 
; Two non-existent categories, so no output:
* {{tlx|Category pair|81st century|83rd century}} → {{Category pair|81st century|83rd century}}
+
* {{tlx|Category pair|AD 10 FIFA World Cup|AD 18 FIFA World Cup}} → {{Category pair|AD 10 FIFA World Cup|AD 18 FIFA World Cup}}
  
 
== Error checking ==
 
== Error checking ==

Revision as of 20:48, 30 April 2019

Usage

Place

on the top of the category page, replacing "CATEGORY NAMEn" with the names only of the target categories, leaving out the term "Category:".

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:

on the top of the category page, replacing "CATEGORY NAME1" with the name only of the target category, leaving out the term "Category:".

If there is no preceding category, then leave the first parameter empty, and simply place:

on the top of the category page, replacing "CATEGORY NAME2" with the name only of the target category, leaving out the term "Category:".

Examples

Preceding and succeeding categories, both exist
Preceding category only, which exists
Succeding 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

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.

If more than two parameters are supplied, the template is unlikely to do what the editor intended e.g.

  • {{tlx|Category pair|CATEGORY NAME1|CATEGORY NAME2|CATEGORY NAME3}} will ignore CATEGORY NAME3
  • {{tlx|Category pair|CATEGORY NAME1||CATEGORY 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