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