Changes
Jump to navigation
Jump to search
add
{{Documentation subpage}}
{{Lua|Module:FindYDCportal}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
A helper template to find the most specific chronology portal which actually exists for a given year or decade. Used to simplify linking to a chronology portal.
It is a wrapper template around [[Module:FindYDCportal]]. For use within templates, it is most efficient to invoke the module directly. For one-off use, the template requires less typing and makes the code easier to read.
== Parameters ==
Takes one parameter, which must be either a year (e.g. "1879", "1123") or a decade (e.g. "1940s", "730s").
If the parameter is missing, empty, or does not fit the required format, an empty string is returned.
== Output ==
If a portal is found, returns its name without the namespace prefix, e.g.
* for "[[Portal:1980s]]" return <code><nowiki>1980s</nowiki></code>
* for "[[Portal:19th century]]" return <code><nowiki>19th century</nowiki></code>
If no portal is found, it returns an empty string.
== Usage ==
; Year parameter
<code><nowiki>{{FindYDCportal|YYYY}}</nowiki></code> ... where <code><nowiki>YYYY</nowiki></code> is a 3- or 4-digit year
; Decade parameter
<code><nowiki>{{FindYDCportal|YYY0s}}</nowiki></code> ... where <code><nowiki>YYY0s</nowiki></code> is a 3- or 4-digit decade
== Examples ==
;Years
* <code><nowiki>{{FindYDCportal|2018}}</nowiki></code> → {{FindYDCportal |2018}}
* <code><nowiki>{{FindYDCportal|1935}}</nowiki></code> → {{FindYDCportal |1935}}
* <code><nowiki>{{FindYDCportal|1857}}</nowiki></code> → {{FindYDCportal |1857}}
* <code><nowiki>{{FindYDCportal|736}}</nowiki></code> → {{FindYDCportal |736}}
* <code><nowiki>{{FindYDCportal|1800}}</nowiki></code> → {{FindYDCportal |1800}}
;Decades
* <code><nowiki>{{FindYDCportal|2000s}}</nowiki></code> → {{FindYDCportal |2000s}}
* <code><nowiki>{{FindYDCportal|1940s}}</nowiki></code> → {{FindYDCportal |1940s}}
* <code><nowiki>{{FindYDCportal|560s}}</nowiki></code> → {{FindYDCportal |560s}}
;Missing parameter
* <code><nowiki>{{FindYDCportal}}</nowiki></code> → {{FindYDCportal}}
;Empty parameter
* <code><nowiki>{{FindYDCportal|}}</nowiki></code> → {{FindYDCportal|}}
;Invalid parameter
* <code><nowiki>{{FindYDCportal|1927-related}}</nowiki></code> → {{FindYDCportal|1927-related}}
* <code><nowiki>{{FindYDCportal|Swedish chef}}</nowiki></code> → {{FindYDCportal|Swedish chef}}
== Logic ==
If the parameter is a year:
# If the year portal exists, return its name.<br>Otherwise try the decade.
# If the decade portal exists, return its name.<br>Otherwise try the century
# If the century portal exists, return its name.<br>Otherwise return an empty string
If the parameter is a decade:
# If the decade portal exists, return its name.<br>Otherwise try the century
# If the century portal exists, return its name.<br>Otherwise return an empty string
== See also ==
* [[Template:Portal]]
* [[Template:Portalbar]]
* [[Wikipedia:Portals]]
<includeonly>{{sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Date-computing templates]]
[[Category:Portal templates]]
}}</includeonly>
{{Lua|Module:FindYDCportal}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
A helper template to find the most specific chronology portal which actually exists for a given year or decade. Used to simplify linking to a chronology portal.
It is a wrapper template around [[Module:FindYDCportal]]. For use within templates, it is most efficient to invoke the module directly. For one-off use, the template requires less typing and makes the code easier to read.
== Parameters ==
Takes one parameter, which must be either a year (e.g. "1879", "1123") or a decade (e.g. "1940s", "730s").
If the parameter is missing, empty, or does not fit the required format, an empty string is returned.
== Output ==
If a portal is found, returns its name without the namespace prefix, e.g.
* for "[[Portal:1980s]]" return <code><nowiki>1980s</nowiki></code>
* for "[[Portal:19th century]]" return <code><nowiki>19th century</nowiki></code>
If no portal is found, it returns an empty string.
== Usage ==
; Year parameter
<code><nowiki>{{FindYDCportal|YYYY}}</nowiki></code> ... where <code><nowiki>YYYY</nowiki></code> is a 3- or 4-digit year
; Decade parameter
<code><nowiki>{{FindYDCportal|YYY0s}}</nowiki></code> ... where <code><nowiki>YYY0s</nowiki></code> is a 3- or 4-digit decade
== Examples ==
;Years
* <code><nowiki>{{FindYDCportal|2018}}</nowiki></code> → {{FindYDCportal |2018}}
* <code><nowiki>{{FindYDCportal|1935}}</nowiki></code> → {{FindYDCportal |1935}}
* <code><nowiki>{{FindYDCportal|1857}}</nowiki></code> → {{FindYDCportal |1857}}
* <code><nowiki>{{FindYDCportal|736}}</nowiki></code> → {{FindYDCportal |736}}
* <code><nowiki>{{FindYDCportal|1800}}</nowiki></code> → {{FindYDCportal |1800}}
;Decades
* <code><nowiki>{{FindYDCportal|2000s}}</nowiki></code> → {{FindYDCportal |2000s}}
* <code><nowiki>{{FindYDCportal|1940s}}</nowiki></code> → {{FindYDCportal |1940s}}
* <code><nowiki>{{FindYDCportal|560s}}</nowiki></code> → {{FindYDCportal |560s}}
;Missing parameter
* <code><nowiki>{{FindYDCportal}}</nowiki></code> → {{FindYDCportal}}
;Empty parameter
* <code><nowiki>{{FindYDCportal|}}</nowiki></code> → {{FindYDCportal|}}
;Invalid parameter
* <code><nowiki>{{FindYDCportal|1927-related}}</nowiki></code> → {{FindYDCportal|1927-related}}
* <code><nowiki>{{FindYDCportal|Swedish chef}}</nowiki></code> → {{FindYDCportal|Swedish chef}}
== Logic ==
If the parameter is a year:
# If the year portal exists, return its name.<br>Otherwise try the decade.
# If the decade portal exists, return its name.<br>Otherwise try the century
# If the century portal exists, return its name.<br>Otherwise return an empty string
If the parameter is a decade:
# If the decade portal exists, return its name.<br>Otherwise try the century
# If the century portal exists, return its name.<br>Otherwise return an empty string
== See also ==
* [[Template:Portal]]
* [[Template:Portalbar]]
* [[Wikipedia:Portals]]
<includeonly>{{sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Date-computing templates]]
[[Category:Portal templates]]
}}</includeonly>