2,243 bytes added
, 06:16, 9 February 2022
<includeonly><!--
# The first step is to check whether this is a category page
-->{{Category other<!--
-->|<!-- ############## It is a category ###############################
# So check that it matches the required format:
# "YYYY beginnings" or "YYYY endings"
# No regexes, so check separately for "beginnings" and "endings"
# In each case, the find function returns 0 for a nomatch, and 1 for a match,
# so we add the two together and take a total of 0 as an error
-->{{#ifeq: {{#expr: {{#invoke:String|find|{{PAGENAME}}|^%d?%d?%d%d beginnings$|plain=false}} + <!--
-->{{#invoke:String|find|{{PAGENAME}}|^%d?%d?%d%d endings$|plain=false}} }}<!--
-->|0<!--
-->|<!-- # Doesn't match
-->{{Error|Invalid page name.<br />[[Template:YYYY beginnings or endings category header]] is for use only on category pages whose title is of the form "YYYY beginnings" or "YYYY endings", where YYYY is a 2-, 3- or 4-digit year.}}<!--
-->[[Category:Errors reported by other category header templates|{{PAGENAME}}]]<!--
-->|<!-- ############### We have a valid category ###############################
-->{{YYYY beginnings or endings category header/core<!--
-->|year={{#invoke:string|replace|{{PAGENAME}}|^(%d+) .+$|%1|plain=false}}<!--
-->|type={{#invoke:string|replace|{{PAGENAME}}|^%d+ (.+)$|%1|plain=false}}<!--
-->}}<!--
-->}}<!--
-->|<!-- ############### Not a category ###############################
-->{{Error|This page is not a category!<br />[[Template:YYYY beginnings or endings category header]] is for use only on category pages whose title is of the form "YYYY beginnings" or "YYYY endings", where YYYY is a 2-, 3- or 4-digit year.}}<!--
-->[[Category:Errors reported by other category header templates|{{PAGENAME}}]]<!--
-->}}</includeonly><!--
# Note {{CatAutoTOC}} needs to be available whether or not this template page has been transcluded
-->{{CatAutoTOC}}<noinclude>
{{Documentation}}<!--
Add categories and interwikis to the /doc subpage, please, not here!
--></noinclude>