From GamingWiki
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | <!-- | |
− | + | ||
− | + | VARIABLES | |
− | + | ||
− | + | Create a variable to hold the year number. | |
− | + | -->{{#vardefine: theyear|<!-- | |
− | + | -->{{#ifeq:{{{1}}}|BC<!-- | |
− | + | -->|{{PAGENAME}}<!-- | |
− | + | -->|{{{year|<!-- Conditional default value: | |
− | + | -->{{#rmatch:{{PAGENAME}}|^\d+$<!-- | |
− | + | -->|{{PAGENAME}}<!-- | |
− | + | -->|{{Campaign year|campaign={{{campaign|}}}}}<!-- | |
− | + | -->}}<!-- | |
− | + | -->}}}<!-- | |
− | + | -->}}<!-- end ifeq | |
− | + | -->}}<!-- | |
− | + | ||
− | + | --><noinclude> | |
− | + | :<!-- | |
− | + | --> We support multiple calendars, if they exist. Calendar definitions are <!-- | |
− | + | --> stored in subtemplates. If the 'campaign' parameter has been <!-- | |
− | + | --> specified, and if <!-- | |
− | + | --> <tt>Template:Year in other calendars/{{{campaign}}}</tt> exists, then <!-- | |
− | + | --> we transclude it. If {{{campaign}}} is unset or the template does not <!-- | |
− | + | --> exist, we use <tt>Template:Year in other calendars/default</tt>. <!-- | |
− | | | + | --></noinclude><!-- |
− | + | ||
− | + | -->{{#vardefine: caltemplate| Year in other calendars/<!-- | |
− | + | If we've specified a campaign, look for that campaign's subtemplate. | |
− | + | -->{{#ifexist: Template:Year in other calendars/{{{campaign|MAGIC_DNE}}}<!-- | |
− | | [[ | + | -->|{{{campaign}}}<!-- |
− | + | -->|default<!-- | |
− | + | -->}}<!-- end ifexist | |
− | + | -->}}<!-- end vardefine | |
− | + | --><includeonly>{{#if: {{{campaign|}}} | [[Category: {{{campaign}}}]] }}</includeonly><!-- | |
− | + | ||
− | + | --><noinclude> | |
− | + | :<!-- | |
− | + | --> The data in the subtemplate is parsed into a HashTable. The keys are <!-- | |
− | + | --> links to pages describing individual calendars, and the values are <!-- | |
− | + | --> years (or year ranges, as appropriate) in the alternate calendar. The <!-- | |
− | + | --> The format of the data is as follows: | |
− | + | <pre> | |
− | + | ;; [[calendar 1]] :: {{#perform_calculation_on|{{{year}}}}} | |
− | + | ;; [[calendar 2]] :: {{{year}}} | |
− | | | + | </pre></noinclude><!-- |
− | | {{ # | + | |
− | | | + | -->{{#vardefine: caldata|{{ {{#var: caltemplate}}|year={{#var:theyear}}}}}}<!-- |
− | | | + | |
− | | | + | -->{{#hashdefine: datahash | {{#var:caldata}} | ;; | :: }}<!-- |
− | + | Remove empty keys: | |
− | {{ | + | -->{{#hashexclude: datahash | }}<!-- |
− | {{!}} | + | |
− | + | --> | |
+ | |||
+ | {| class="infobox floatright" | ||
+ | |+ class="above" | {{#var:theyear}} in other calendars | ||
+ | {{#hashprint: datahash ||%%%% |@@@@ |<nowiki /> | ||
+ | {{!}}- | ||
+ | {{!}} class="label" {{!}} %%%% | ||
+ | {{!}} @@@@ <!-- | ||
+ | -->}}<!-- --><nowiki /> | ||
{{#if: {{{footnotes|}}} | | {{#if: {{{footnotes|}}} | | ||
+ | {{!}}- | ||
{{!}} colspan="2" {{!}} <small>{{{footnotes|}}}</small> | {{!}} colspan="2" {{!}} <small>{{{footnotes|}}}</small> | ||
}} | }} | ||
|- | |- | ||
− | |colspan="2" | + | | colspan="2" class="below" | <!-- |
+ | --> {{navbar|Year in other calendars|mini=1|nodiv=1|brackets=1|label=Box:}} <!-- | ||
+ | --> {{navbar|{{#var:caltemplate}}|mini=1|nodiv=1|brackets=1|label=Data:}} | ||
|}<noinclude> | |}<noinclude> | ||
{{documentation}} | {{documentation}} | ||
</noinclude> | </noinclude> |
Latest revision as of 07:15, 15 December 2012
- We support multiple calendars, if they exist. Calendar definitions are stored in subtemplates. If the 'campaign' parameter has been specified, and if Template:Year in other calendars/{{{campaign}}} exists, then we transclude it. If {{{campaign}}} is unset or the template does not exist, we use Template:Year in other calendars/default.
- The data in the subtemplate is parsed into a HashTable. The keys are links to pages describing individual calendars, and the values are years (or year ranges, as appropriate) in the alternate calendar. The The format of the data is as follows:
;; [[calendar 1]] :: {{#perform_calculation_on|{{{year}}}}} ;; [[calendar 2]] :: {{{year}}}
Gregorian calendar | 2024 MMXXIV |
Ab urbe condita | 2777 |
Bahá'í calendar | 180 – 181 |
Bengali calendar | 1431 |
Berber calendar | 2974 |
Buddhist calendar | 2568 |
Burmese calendar | 1386 |
Byzantine calendar | 7532 – 7533 |
Coptic calendar | 1740 – 1741 |
Ethiopian calendar | 2016 – 2017 |
Hebrew calendar | 5784 – 5785 |
Holocene calendar | 12024 |
Iranian calendar | 1402 – 1403 |
Islamic calendar | 1445 – 1446 |
Korean calendar | 4357 |
Thai solar calendar | 2567 |
Unix time | 1704067200 – 1735689599 |
[create]
Error creating thumbnail: File missing
Template documentation Editors can experiment in this template's sandbox (create) and testcases (create) pages. Please add categories and interwikis to the /doc subpage. Subpages of this template. |