Template:YearNav: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
(returning to previous div structure)
(Whoop, wrong page)
Tag: 2017 source edit
 
(111 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<noinclude>{{Documentation}}</noinclude>
<includeonly>{| class="timeline"
<includeonly>{| class="noprint" style="clear: both; -moz-border-radius:10px; border-left: inset black 5px; margin: 0 0 .5em .5em; background: #d8d8d8; width: 246px; padding: 0px; spacing: 0px; text-align: left; float: right;"
|-
|-
| style="margin-left: 0px;margin-top:2px;line-height:110%;text-align:center; font-size:150%;"|[[Timeline]]  
| style="padding:10px;margin-left: 0px;margin-top:2px;line-height:110%;text-align:center; font-size:150%;"|[[Timeline]] for {{#ifexpr:{{dda}} > 9999|{{formatnum:{{dda}}}}|{{dda}}}}
|-
|-
|{{#ifexpr:{{PAGENAME}} > 9999|<center>'''[[Far future]]'''</center>|century: [[{{nth|{{#expr:(({{PAGENAME}}-({{PAGENAME}} mod 100))/100)+1}}}} century]] decade: [[{{#expr: {{PAGENAME}} - ({{PAGENAME}} mod 10)}}s]]|}}
|{{#ifexpr:{{dda}} > 9999|<center>'''[[Far future]]'''</center>|<center>[[{{nth|{{#expr:(({{dda}}-({{dda}} mod 100))/100)+1}}}} century]] {{#ifeq:{{PAGESIZE:{{#expr:({{dda}} - ({{dda}} mod 10))}}s}}|0| |{{!}} [[{{#expr: {{dda}} - ({{dda}} mod 10)}}s]]|}}}}
|-align="center"
|{{#ifexpr:{{dda}} > 9999| |<hr>{{#ifexpr:{{PAGESIZE:{{#expr:{{#sub:{{PAGENAME}}|0|4}}-6}} {{daydab}}|R}}=0| |[[{{#expr:{{#sub:{{dda}}|0|4}}-6}} {{daydab}}|{{#expr:{{#sub:{{dda}}|0|4}}-6}}]]}} {{#ifeq:{{PAGESIZE:{{#expr:{{#sub:{{PAGENAME}}|0|4}}-5}} {{daydab}}|R}}|0| |•&nbsp;[[{{#expr:{{#sub:{{dda}}|0|4}}-5}} {{daydab}}|{{#expr:{{#sub:{{dda}}|0|4}}-5}}]]}} {{#ifeq:{{PAGESIZE:{{#expr:{{#sub:{{dda}}|0|4}}-4}} {{daydab}}|R}}|0| |•&nbsp;[[{{#expr:{{#sub:{{dda}}|0|4}}-4}} {{daydab}}|{{#expr:{{#sub:{{dda}}|0|4}}-4}}]]}} {{#ifeq:{{PAGESIZE:{{#expr:{{#sub:{{dda}}|0|4}}-3}} {{daydab}}|R}}|0| |•&nbsp;[[{{#expr:{{#sub:{{dda}}|0|4}}-3}} {{daydab}}|{{#expr:{{#sub:{{dda}}|0|4}}-3}}]]}} {{#ifeq:{{PAGESIZE:{{#expr:{{#sub:{{dda}}|0|4}}-2}} {{daydab}}|R}}|0| |•&nbsp;[[{{#expr:{{#sub:{{dda}}|0|4}}-2}} {{daydab}}|{{#expr:{{#sub:{{dda}}|0|4}}-2}}]]}} {{#ifeq:{{PAGESIZE:{{#expr:{{#sub:{{dda}}|0|4}}-1}} {{daydab}}|R}}|0| |•&nbsp;[[{{#expr:{{#sub:{{dda}}|0|4}}-1}} {{daydab}}|{{#expr:{{#sub:{{dda}}|0|4}}-1}}]]}} {{#ifeq:{{PAGESIZE:{{#expr:{{#sub:{{dda}}|0|4}}+1}} {{daydab}}|R}}|0| |•&nbsp;[[{{#expr:{{#sub:{{dda}}|0|4}}+1}} {{daydab}}|{{#expr:{{#sub:{{dda}}|0|4}}+1}}]]}} {{#ifeq:{{PAGESIZE:{{#expr:{{#sub:{{dda}}|0|4}}+2}} {{daydab}}|R}}|0| |•&nbsp;[[{{#expr:{{#sub:{{dda}}|0|4}}+2}} {{daydab}}|{{#expr:{{#sub:{{dda}}|0|4}}+2}}]]}} {{#ifeq:{{PAGESIZE:{{#expr:{{#sub:{{dda}}|0|4}}+3}} {{daydab}}|R}}|0| |•&nbsp;[[{{#expr:{{#sub:{{dda}}|0|4}}+3}} {{daydab}}|{{#expr:{{#sub:{{dda}}|0|4}}+3}}]]}} {{#ifeq:{{PAGESIZE:{{#expr:{{#sub:{{dda}}|0|4}}+4}} {{daydab}}|R}}|0| |•&nbsp;[[{{#expr:{{#sub:{{dda}}|0|4}}+4}} {{daydab}}|{{#expr:{{#sub:{{dda}}|0|4}}+4}}]]}} {{#ifeq:{{PAGESIZE:{{#expr:{{#sub:{{dda}}|0|4}}+5}} {{daydab}}|R}}|0| |•&nbsp;[[{{#expr:{{#sub:{{dda}}|0|4}}+5}} {{daydab}}|{{#expr:{{#sub:{{dda}}|0|4}}+5}}]]}} {{#ifeq:{{PAGESIZE:{{#expr:{{#sub:{{dda}}|0|4}}+6}} {{daydab}}|R}}|0| |•&nbsp;[[{{#expr:{{#sub:{{dda}}|0|4}}+6}} {{daydab}}|{{#expr:{{#sub:{{dda}}|0|4}}+6}}]]}}}}
|-
|-
|{{#ifexpr:{{PAGENAME}} > 9999| |previous year: [[{{{1|{{#expr:{{PAGENAME}}-1}}}}}]]  next year: [[{{{2|{{#expr:{{PAGENAME}}+1}}}}}]]}}
|{{#ifexpr:{{dda}} <= {{#expr:{{CURRENTYEAR}}+10}}|[[File:WikipediaInfo.png|center|link=wikipedia:{{dda}}]]| |}}
|-
|-
|{{#ifexpr:{{PAGENAME}} <= {{#expr:{{CURRENTYEAR}}+10}}|<hr><div style="float: left; margin .5em .5em .5em .5em;">[[Image:Smallwikipedialogo.png|30px|none|Wikipedia|link=[[wikipedia:Main Page]]]]</div><div style="margin-left: 0px;padding:0px;margin-top:7px;line-height:110%;text-align:left; font-size:80%;">'''Wikipedia''' has  '''[[Wikipedia:{{{1|{{PAGENAME}}}}}|a more detailed and comprehensive article on {{{2|{{PAGENAME}}}}}]]'''</div>| |}}
|}{{#ifexpr:{{dda}} >9999|[[Category:Far future| {{padleft:{{dda}}|33}}]]|[[Category:{{nth|{{#expr:(({{dda}}-({{dda}} mod 100))/100)+1}}}} century years]][[Category:{{#expr: {{dda}} - ({{dda}} mod 10)}}s]]|}} </includeonly><noinclude>[[Category:Timeline templates]][[Category:Templates that add a category]]{{Documentation}}</noinclude>
|-
|}{{#ifexpr:{{PAGENAME}} >9999|[[category:Far future]]|[[category:{{nth|{{#expr:(({{PAGENAME}}-({{PAGENAME}} mod 100))/100)+1}}}} century years]][[category:{{#expr: {{PAGENAME}} - ({{PAGENAME}} mod 10)}}s]]|}} </includeonly><noinclude>[[Category:Template sandbox]]</noinclude>

Latest revision as of 00:13, 30 December 2021

Instructions for {{YearNav}}
Do not directly call this template. It is used to support other templates. Once another template decides that the topic of a page is a year, this template will automatically provide a navigation box.

It is completely automatic, and has no user-definable parameters.

Sample output

Because this template is dependent upon detecting a PAGENAME that is a year, its output can only be seen on a year page. It is impossible to reproduce its results here. If you wish to test it, go to any year and add {{timeline}} to the page.

Future implementation

It may be that in the future the coding can be made a bit simpler. I haven't tried the following language on pages that are less than 4 digits long but it seems like it'd work:

{{#ifexpr:{{PAGESIZE:{{#expr:({{PAGENAME}}-6)}}|R}}>0|[[{{#expr:{{PAGENAME}}-6}}]]|nothin  }}  

czechout<staff />   03:52: Fri 22 Jun 2012 

Maintenance log

  • Template was fixed today in response to odd errors that were creeping up only on some pages. Most of the #ifexpr calls were replaced by simpler #ifeq calls, and this has alleviated a lot of the errors that were taking place, particularly in the 1990s and 2000s.
    czechout<staff />    20:47: Mon 03 Sep 2012