Template:(Dis)establishments in year category header and Template:(Dis)establishments in year category header/sandbox: Difference between pages
(Difference between pages)
Imported template from English Wikipedia (sanitized) |
Imported template from English Wikipedia (sanitized) |
||
| Line 4: | Line 4: | ||
-->|<!-- ############### It is a category ############################### | -->|<!-- ############### It is a category ############################### | ||
# So check that it matches the required format: "YYYY establishments" or "YYYY disestablishments" | # So check that it matches the required format: "YYYY establishments" or "YYYY disestablishments" | ||
# No regexes, so check separately for "establishments" and "disestablishments" | |||
# In each case, the find function returns 0 for a nomatch, and 1 for a match, | # 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 | # so we add the two together and take a total of 0 as an error | ||
-->{{#ifeq: {{#invoke:String|find|{{PAGENAME}}|^ | -->{{#ifeq: {{#expr: {{#invoke:String|find|{{PAGENAME}}|^%d?%d?%d?%d establishments$|plain=false}} + <!-- | ||
-->{{#invoke:String|find|{{PAGENAME}}|^%d?%d?%d?%d disestablishments$|plain=false}} }}<!-- | |||
-->|0<!-- | -->|0<!-- | ||
-->|<!-- # Doesn't match | -->|<!-- # Doesn't match | ||
| Line 13: | Line 15: | ||
-->|<!-- | -->|<!-- | ||
-->{{(Dis)establishments in year category header/core<!-- | -->{{(Dis)establishments in year category header/core<!-- | ||
-->|year={{#invoke:String|replace|{{PAGENAME}}|pattern=^ | -->|year={{#invoke:String|replace|{{PAGENAME}}|pattern=^(%d?%d?%d?%d) (d?i?s?establishments)$|%1|1|false}}<!-- | ||
-->|type={{#invoke:String|replace|{{PAGENAME}}|pattern=^(%d?%d?%d?%d) (d?i?s?establishments)$|%2|1|false}}<!-- | |||
-->|type={{#invoke:String|replace|{{PAGENAME}}|pattern=^ | |||
-->}}<!-- | -->}}<!-- | ||
-->}}<!-- | -->}}<!-- | ||
| Line 35: | Line 31: | ||
e.g. | e.g. | ||
* [[:Category: | * [[:Category:6 establishments]] | ||
* [[:Category:95 establishments]] | * [[:Category:95 establishments]] | ||
* [[:Category:727 establishments]] | * [[:Category:727 establishments]] | ||
* [[:Category:1842 establishments]] | * [[:Category:1842 establishments]] | ||
* [[:Category: | * [[:Category:9 disestablishments]] | ||
* [[:Category:420 disestablishments]] | * [[:Category:420 disestablishments]] | ||
* [[:Category:525 disestablishments]] | * [[:Category:525 disestablishments]] | ||
| Line 51: | Line 47: | ||
* [[Template:(Dis)establishments in decade category header]] | * [[Template:(Dis)establishments in decade category header]] | ||
}} | }} | ||
</noinclude> | </noinclude> | ||