Difference between revisions of "Template:Category pair/doc"
Jump to navigation
Jump to search
imported>Tom.Reding (→See also: +{{tl|Navseasoncats}} — for similarly named sequential categories) |
imported>Tom.Reding (→Usage: Simplify, formatting, tidy) |
||
| Line 5: | Line 5: | ||
==Usage== | ==Usage== | ||
| − | + | * 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: | |
| + | : {{tlx|Category pair|NAME1}} | ||
| + | : an the top of the category page. | ||
| − | + | * If there is no preceding category, then leave the first parameter empty, and simply place: | |
| − | * | + | : {{tlx|Category pair|<nowiki></nowiki>|NAME2}} |
| − | + | : an the top of the category page. | |
| − | |||
| − | If there is no preceding category, then leave the first parameter empty, and simply place: | ||
| − | |||
| − | |||
==Examples== | ==Examples== | ||
Revision as of 01:34, 1 May 2019
| 40px | This is a documentation subpage for Template:Category pair. It contains usage information, categories and other content that is not part of the original template page. |
| 40px | This template is used on approximately 4,200 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them.
Transclusion count updated automatically (see documentation). |
| 30px | This template uses Lua: |
Usage
- For 2 adjacent categories, a preceding
Category:NAME1, and a succeedingCategory: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}}- an the top of the category page.
- If there is no preceding category, then leave the first parameter empty, and simply place:
{{Category pair||NAME2}}- an the top of the category page.
Examples
- Preceding and succeeding categories, both exist
{{Category pair|1934 FIFA World Cup|1950 FIFA World Cup}}→
- Preceding category only, which exists
{{Category pair|1934 FIFA World Cup}}→
- Succeding category only, which exists
{{Category pair||1950 FIFA World Cup}}→
- 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
{{Category pair|AD 10 FIFA World Cup|AD 18 FIFA World Cup}}→
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
- {{Navseasoncats}} — for similarly named sequential categories
- {{Preceding category}}
- {{Succeeding category}}
- {{Category see also}}
- {{Category see also if exists}}