From GamingWiki
Jump to: navigation, search
(Created page with "{| class="infobox" width=300 <!-- wider than 300 would chop or eclipse article text after Template:Year_nav. --> |- | align="center" | '''[[:Category:{{PAGENAME}}|{{PAGENAME...")
 
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
{| class="infobox" width=300 <!-- wider than 300 would chop or eclipse article text after [[:Template:Year_nav]]. -->
+
<noinclude>
 +
Display an infobox linking to the various topics related to this year.
 +
</noinclude><!--
 +
 
 +
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 create a variable containing the name of the subtemplate containing <!--
 +
--> data for our infobox. This data will be parsed into a HashTable. The  <!--
 +
--> keys of the hash are the sections of the "year in" topics, and each    <!--
 +
--> value is a link to the relevant page. The format of the data is:     
 +
;; key1 :: value1-1 :: value1-2
 +
;; key2 :: value2-1
 +
;; key3 :: value3-1 :: value3-2 :: value3-3
 +
:<!--
 +
--> Et cetera. Each key starts with a double semicolon and may be followed <!--
 +
--> by any number of values, separated from the key and from each other by <!--
 +
--> double colons.                                                        <!--
 +
--></noinclude><!--
 +
-->{{#vardefine: datatemplate|Year in topic/<!--
 +
  If we've specified a campaign, look for that campaign's subtemplate.
 +
  -->{{#ifexist: Template:Year in topic/{{{campaign|MAGIC_DNE}}}<!--
 +
      -->|{{{campaign}}}<!--
 +
      -->|default<!--
 +
  -->}}<!-- end ifexist
 +
-->}}<!-- end vardefine
 +
 
 +
Define a big data array.
 +
 
 +
-->{{#vardefine: ytdata|{{ {{#var: datatemplate}}|year={{#var:theyear}}}}}}<!--
 +
 
 +
-->{{#hashdefine: datahash | {{#var:ytdata}} | ;; | :: }}<!--
 +
 
 +
  If an empty key exists, any value it contains will be evaluated as wikitext.
 +
  This allows us to insert things like category specifications that don't
 +
  become part of the data variable. Once evaluated, the empty key is
 +
  removed from the hash.
 +
-->{{#hashvalue: datahash | }}<!--
 +
-->{{#hashexclude: datahash | }}<!--
 +
 
 +
-->
 +
{| class="infobox floatright"
 +
| align="center" class="above" | <!--
 +
--><div class="floatleft">&laquo; [[{{#expr:{{#var:theyear}}-1}}]]</div><!--
 +
-->{{#var:theyear}} by topic<!--
 +
--><div class="floatright">[[{{#expr:{{#var:theyear}}+1}}]] &raquo;</div><!--
 +
-->{{#hashprint: datahash ||%%%% |@@@@ |<nowiki />
 +
{{!}}-
 +
{{!}} class="subhead" {{!}} %%%%
 +
{{!}}-
 +
{{!}}{{!}} {{Array Map | array=@@@@ | separator = :: | beforefirst = | before = &nbsp;&ndash;&nbsp; }}<!--
 +
-->}}<!-- --><nowiki />
 
|-
 
|-
| align="center" | '''[[:Category:{{PAGENAME}}|{{PAGENAME}} by topic]]:'''
+
| class="below" | <!--
|- style="background-color:#f3f3f3"
+
--> {{navbar|Year in topic|mini=1|nodiv=1|brackets=1|label=Box:}} <!--
| align="center" | <small>''Subject''</small>
+
--> {{navbar|{{#var:datatemplate}}|mini=1|nodiv=1|brackets=1|label=Data:}}
|-
+
|}<!--
| align="center" | [[{{PAGENAME}} in archaeology|Archaeology]] – [[{{PAGENAME}} in architecture|Architecture]] – [[{{PAGENAME}} in art|Art]] – [[{{PAGENAME}} in aviation|Aviation]] – [[:Category:{{PAGENAME}} awards|Awards]] – [[{{PAGENAME}} in comics|Comics]] – [[{{PAGENAME}} in film|Film]] {{#ifexpr:{{PAGENAME}}>=1970 | – [[{{PAGENAME}} in home video|Home video]]}} – [[{{PAGENAME}} in literature|Literature]] ([[{{PAGENAME}} in poetry|Poetry]]) – [[:Category:{{PAGENAME}} meteorology|Meteorology]] – [[{{PAGENAME}} in music|Music]] {{#ifexpr:{{PAGENAME}}>=1920 |([[{{PAGENAME}} in country music|Country]]{{#ifexpr:{{PAGENAME}}>=1970 |, [[{{PAGENAME}} in metal|Metal]]}})}} – [[{{PAGENAME}} in rail transport|Rail transport]] – [[{{PAGENAME}} in radio|Radio]] – [[{{PAGENAME}} in science|Science]] – {{#ifexpr:{{PAGENAME}}>=1951 |{{#ifexist:{{PAGENAME}} in spaceflight|[[{{PAGENAME}} in spaceflight|Spaceflight]] –}}}} {{#ifexpr:{{PAGENAME}}<1951 and {{PAGENAME}}>1943|[[Spaceflight before 1951|Spaceflight]] – }} [[{{PAGENAME}} in sports|Sports]] – [[{{PAGENAME}} in television|Television]] {{#ifexpr:{{PAGENAME}}=1952 or {{PAGENAME}}=1958 or {{PAGENAME}}=1962 or {{PAGENAME}}>=1972 | – [[{{PAGENAME}} in video gaming|Video gaming]]}}
+
 
|- style="background-color:#f3f3f3"
+
  TODO: implement "other calendars"
| align="center" | <small>''By country''</small>
+
 
|-
+
--><noinclude>
|align="center" | [[{{PAGENAME}} in Australia|Australia]] – [[{{PAGENAME}} in Canada|Canada]] {{#ifexpr:{{PAGENAME}}<=1948 | – [[{{PAGENAME}} in China|China]]}} {{#ifexpr:{{PAGENAME}}>=1949 | – [[{{PAGENAME}} in the People's Republic of China|People's Republic of China]]}} – [[{{PAGENAME}} in Ecuador|Ecuador]] – [[{{PAGENAME}} in France|France]] – [[{{PAGENAME}} in Germany|Germany]] – [[{{PAGENAME}} in Greece|Greece]] – [[{{PAGENAME}} in India|India]] – [[{{PAGENAME}} in Ireland|Ireland]] {{#ifexpr:{{PAGENAME}}>=1948 | – [[{{PAGENAME}} in Israel|Israel]]}} – [[{{PAGENAME}} in Italy|Italy]] – [[{{PAGENAME}} in Japan|Japan]] {{#ifexpr:{{PAGENAME}}>=1946 | – [[{{PAGENAME}} in Luxembourg |Luxembourg]]}} – [[{{PAGENAME}} in Malaysia|Malaysia]] – [[{{PAGENAME}} in Mexico|Mexico]] – [[{{PAGENAME}} in New Zealand|New Zealand]] – [[{{PAGENAME}} in Norway|Norway]] {{#ifexpr:{{PAGENAME}}<=1918| – [[{{PAGENAME}} in Ottoman Syria|Ottoman Syria]]}} {{#ifexpr:{{PAGENAME}}>=1946 | – [[{{PAGENAME}} in Pakistan|Pakistan]]}}{{#ifexpr:{{PAGENAME}}<=1920 and {{PAGENAME}}>=1918| – [[{{PAGENAME}} in British-administered Palestine|Palestine (British administered)]]}} {{#ifexpr:{{PAGENAME}}<=1948 and {{PAGENAME}}>=1921 | – [[{{PAGENAME}} in the British Mandate of Palestine|Palestine Mandate]]}} – [[{{PAGENAME}} in Philippines|Philippines]] {{#ifexpr:{{PAGENAME}}<=1922 or {{PAGENAME}}>=1991| – [[{{PAGENAME}} in Russia|Russia]]}} – [[{{PAGENAME}} in Singapore|Singapore]] – [[{{PAGENAME}} in South Africa|South Africa]]{{#ifexpr:{{PAGENAME}}<=1991 and {{PAGENAME}}>=1922| – [[{{PAGENAME}} in the Soviet Union|Soviet Union]]}} – [[{{PAGENAME}} in the United Kingdom|UK]] – [[{{PAGENAME}} in the United States|USA]] {{#ifexpr:{{PAGENAME}}>=1980 | – [[{{PAGENAME}} in Zimbabwe|Zimbabwe]]}}
+
:<!--
|- style="background-color:#f3f3f3"
+
--> We also support multiple calendars, if they exist. The mechanism for  <!--
| align="center" | <small>''Leaders''<small>
+
--> choosing a template to transclude is similar to the data template: if  <!--
|-
+
--> the 'campaign' parameter has been specified, and if the page          <!--
| align="center" | [[List of sovereign states in {{PAGENAME}}|Sovereign states]] – [[List of state leaders in {{PAGENAME}}|State leaders]] – [[List of religious leaders in {{PAGENAME}}|Religious leaders]] – [[:Category:{{PAGENAME}} in law|Law]]
+
--> <tt>Template:Year in other calendars/{{{campaign}}}</tt> exists, then  <!--
|- style="background-color:#f3f3f3"
+
--> we transclude it. If {{{campaign}}} is unset or, or the template does  <!--
| align="center" | <small>''Birth and death categories''</small>
+
--> not exist, we use <tt>Template:Year in other calendars/default</tt>.  <!--
|-
+
--></noinclude><!--
| align="center" | [[:Category:{{PAGENAME}} births|Births]] – [[:Category:{{PAGENAME}} deaths|Deaths]]
+
-->{{#vardefine: calendars| Year in other calendars/<!--
|-style="background-color:#f3f3f3"
+
  If we've specified a campaign, look for that campaign's subtemplate.
| align="center" | <small>''Establishments and disestablishments categories''</small>
+
  -->{{#ifexist: Template:Year in other calendars/{{{campaign|MAGIC_DNE}}}<!--
|-
+
      -->|{{{campaign}}}<!--
| align="center" | [[:Category:{{PAGENAME}} establishments|Establishments]] – [[:Category:{{PAGENAME}} disestablishments|Disestablishments]]
+
      -->|default<!--
|- style="background-color:#f3f3f3"
+
  -->}}<!-- end ifexist
| align="center" | <small>''Works and introductions categories''</small>
+
-->}}<!-- end vardefine
|-
+
--><!-- {{ {{#var:calendars}}|year={{#var:theyear}}}} --><!--
| align="center" | [[:Category:{{PAGENAME}} works|Works]] – [[:Category:{{PAGENAME}} introductions|Introductions]]
+
-->{{Year in other calendars
|-
+
| year = {{#var:theyear}}  
| {{navbar|C20 year in topic|mini=1}}
+
| campaign = {{{campaign|}}} }}<!--
|}
+
 
{{Year in other calendars<noinclude>|year=1950</noinclude>}}<noinclude>
+
--><noinclude>
[[Category:Time, date and calendar templates|{{PAGENAME}}]]</noinclude>
+
[[Category:Time, date and calendar templates|{{#var:theyear}}]]</noinclude>

Latest revision as of 16:26, 22 February 2011

Display an infobox linking to the various topics related to this year.

We create a variable containing the name of the subtemplate containing data for our infobox. This data will be parsed into a HashTable. The keys of the hash are the sections of the "year in" topics, and each value is a link to the relevant page. The format of the data is:
;; key1 :: value1-1 :: value1-2
;; key2 :: value2-1
;; key3 :: value3-1 :: value3-2 :: value3-3
Et cetera. Each key starts with a double semicolon and may be followed by any number of values, separated from the key and from each other by double colons.
« 2023
2024 by topic
2025 »
Subject
Archaeology – Architecture – Art – Aviation – Awards – Comics – Film – Home video – Literature (Poetry) – Meteorology – Music (Country, Metal) – Rail transport – Radio – Science – Sports – Television – Video gaming
By country
Australia – Canada – People's Republic of China – Ecuador – France – Germany – Greece – India – Ireland – Israel – Italy – Japan – Luxembourg – Malaysia – Mexico – New Zealand – Norway – Pakistan – Philippines – Russia – Singapore – South Africa – UK – USA – Zimbabwe
Leaders
Sovereign states – State leaders – Religious leaders – Law
Birth and death
Births – Deaths
Establishments and disestablishments
Establishments – Disestablishments
Works and introductions
Works – Introductions
 Box: [v  e]   Data: [v  e] 
We also support multiple calendars, if they exist. The mechanism for choosing a template to transclude is similar to the data template: if the 'campaign' parameter has been specified, and if the page Template:Year in other calendars/{{{campaign}}} exists, then we transclude it. If {{{campaign}}} is unset or, or the template does not exist, we use Template:Year in other calendars/default.
2024 in other calendars
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
 Box: [v  e]   Data: [v  e]