Module:FindYDCportal/doc
| This module is rated as ready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing. |
| This Lua module is used on approximately 393,000 pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
A helper module to find the most specific chronology portal which actually exists for a given year or decade. Used to simplify linking to a chronology portal.
- October 2019 update
All by-year and by-century portals have been deleted. There are now only 8 decade portals, listed in Category:Decades portals.
So all checking for century and year portals has been disabled.
If any of the decade portals are deleted, then this module should be edited to remove that decade from the table existingDecadePortals
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
1980s - for "Portal:19th century" return
19th century
If no portal is found, it returns an empty string.
Usage
- Year parameter
{{#invoke: FindYDCportal | findydcportal |YYYY}} ... where YYYY is a 3- or 4-digit year
- Decade parameter
{{#invoke: FindYDCportal | findydcportal |YYY0s}} ... where YYY0s is a 3- or 4-digit decade
Examples
- Years
{{#invoke: FindYDCportal | findydcportal |2018}}→ 2010s{{#invoke: FindYDCportal | findydcportal |1935}}→{{#invoke: FindYDCportal | findydcportal |1857}}→{{#invoke: FindYDCportal | findydcportal |736}}→{{#invoke: FindYDCportal | findydcportal |1800}}→
- Decades
{{#invoke: FindYDCportal | findydcportal |2000s}}→ 2000s{{#invoke: FindYDCportal | findydcportal |1940s}}→{{#invoke: FindYDCportal | findydcportal |560s}}→
- Missing parameter
{{#invoke: FindYDCportal | findydcportal}}→
- Empty parameter
{{#invoke: FindYDCportal | findydcportal | }}→
- Invalid parameter
{{#invoke: FindYDCportal | findydcportal | 1927-related}}→{{#invoke: FindYDCportal | findydcportal | Swedish chef}}→
Logic
If the parameter is a year:
- If the year portal exists, return its name.
Otherwise try the decade. - If the decade portal exists, return its name.
Otherwise try the century - If the century portal exists, return its name.
Otherwise return an empty string
If the parameter is a decade:
- If the decade portal exists, return its name.
Otherwise try the century - If the century portal exists, return its name.
Otherwise return an empty string
See also
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.