Difference between revisions of "Template:Cat in use/doc"

From blackwiki
Jump to navigation Jump to search
imported>Sardanaphalus
(replaced <tt>, some slight rephrasing, category update)
imported>Vanisaac
m (→‎See also: clean up per WP:CAT#T and WP:AWBREQ add template:Sandbox other)
 
(3 intermediate revisions by 2 users not shown)
Line 5: Line 5:
  
 
===Usage===
 
===Usage===
 
 
* <code><nowiki>{{cat in use| Wikipedia }}</nowiki></code> → {{cat in use|Wikipedia}}
 
* <code><nowiki>{{cat in use| Wikipedia }}</nowiki></code> → {{cat in use|Wikipedia}}
 
* <code><nowiki>{{cat in use| Avpoaihaw }}</nowiki></code> → {{cat in use|Avpoaihaw}}
 
* <code><nowiki>{{cat in use| Avpoaihaw }}</nowiki></code> → {{cat in use|Avpoaihaw}}
  
 
The second parameter can be used to indicate the comparison performed:
 
The second parameter can be used to indicate the comparison performed:
* <code>'''or'''</code> returns true if the category exists ''or'' has members {{padr|''(default)''}};
+
* <code>'''or'''</code> returns "1" (true) if the category exists ''or'' has members (default);
* <code>'''and'''</code> returns true if the category exists ''and'' has members;
+
* <code>'''and'''</code> returns "1" (true) if the category exists ''and'' has members;
* <code>'''xor'''</code> returns true if the category exists but is empty, or if the category does not exist but has members<!--[Not as weird/uncommon as may be thought!:] (slightly weird, admittedly {{plaincode|{{colon}}D}})-->.
+
* <code>'''xor'''</code> returns "1" (true) if the category exists but is empty, or if the category does not exist but has members<!--[Not as weird/uncommon as may be thought!:] (slightly weird, admittedly {{plaincode|{{colon}}D}})-->.
  
 
===See also===
 
===See also===
  
<includeonly>
+
<includeonly>{{Sandbox other||
 
<!-- CATEGORIES BELOW THIS LINE, PLEASE: -->
 
<!-- CATEGORIES BELOW THIS LINE, PLEASE: -->
 
[[Category:Category namespace templates]]
 
[[Category:Category namespace templates]]
  
[[ja:Template:Cat in use]]
+
}}</includeonly>
</includeonly>
 

Latest revision as of 00:53, 24 April 2020

This template checks whether a category is 'in use', checking various combinations of whether the category exists (is not a redlink) and is populated (has pages in it).

Usage

  • {{cat in use| Wikipedia }} → 0
  • {{cat in use| Avpoaihaw }} → 0

The second parameter can be used to indicate the comparison performed:

  • or returns "1" (true) if the category exists or has members (default);
  • and returns "1" (true) if the category exists and has members;
  • xor returns "1" (true) if the category exists but is empty, or if the category does not exist but has members.

See also