Template:Foos (dis)established in YYYY category header

To make a category of the form "Foos established in YYYY" or "Foos disestablished in YYYY", where YYYY is a year (e.g. "872", "1976", or "2015"), and "Foos" is a type of entity, e.g. "Companies" or "Hospitals"
e.g.
Usage
{{Foos (dis)established in YYYY category header}}
No parameters are needed, but some optional parameters may be supplied.
How it works
The template parses the page title, and derives three items from it:
- The type of entity
- The action, i.e. either "established" or "disestablished"
- The year
So for example, if used on Category:Organizations established in 1837:
- type = "Organizations"
- action = "established"
- year = 1837
That page is categorised in three parent categories:
- Category:Organizations by year of establishment
- Category:Organizations established in the 1830s
- Category:1837 establishments
In some cases, this is sufficient. However, in other cases, the parent category should be a sub-category of Category:1837 establishments.
Foe example, Category:Transport companies established in 1926 should be a sub-category of Category:Companies established in 1926, and per WP:SUBCAT it should not be directly in Category:1926 establishments.
In cases such as these, extra parameters are needed.
Parameters for establishment type parent categories
Up to three un-named parameters may be used to specify parent types
e.g. On Category:Transport companies established in 1926:
{{Foos (dis)established in YYYY category header|Companies}}
The parameter "Companies" causes the page to be parented in Category:Companies established in 1926, instead of Category:1926 establishments
Redirects
- Template:Foos established in YYYY category header
- Template:Foos disestablished in YYYY category header