Template:CenturyNav: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
(trying to update so that it properly handles 1, 2 and 3 digits)
(Undo revision 2563493 by SOTO (talk))
 
(17 intermediate revisions by 2 users not shown)
Line 7: Line 7:
|#default= {{#switch:{{#pos:{{PAGENAME}}|c}}
|#default= {{#switch:{{#pos:{{PAGENAME}}|c}}
|4=previous: [[{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|1}}-1}}}} century]] next: [[{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|1}}+1}}}} century]]  
|4=previous: [[{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|1}}-1}}}} century]] next: [[{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|1}}+1}}}} century]]  
|6=previous: [[{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|3}}-1}}}} century]] next: [[{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|3}}+1}}}} century]] }}
|7|6=<div id=ssh style=text:align:center>[[Far future]]</div>
|#default=|#default=previous: [[{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|2}}-1}}}} century]] next: [[{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|2}}+1}}}} century]] }}
|#default=previous: [[{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|2}}-1}}}} century]] next: [[{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|2}}+1}}}} century]] }}
}}
}}
}}
|-
|-
Line 18: Line 17:
{{#switch:{{#pos:{{PAGENAME}}|c}}
{{#switch:{{#pos:{{PAGENAME}}|c}}
|4=[[Category:{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|1}}}}}} century| *]][[Category:Centuries]]  
|4=[[Category:{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|1}}}}}} century| *]][[Category:Centuries]]  
|6==[[Category:{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|3}}}}}} century| *]][[Category:Centuries]]
|6=[[Category:{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|3}}}}}} century| *]][[Category:Centuries]]
|#default==[[Category:{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|2}}}}}} century| *]][[Category:Centuries]]
|7=[[Category:{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|4}}}}}} century| *]][[Category:Centuries]]  
}}
|#default=[[Category:{{nth|{{#expr:{{#sub:{{PAGENAME}}|0|2}}}}}} century| *]][[Category:Centuries]]
|suppresserrors=true
|suppresserrors=true
|}</includeonly>
}}</includeonly>
<noinclude>{{documentation}}[[Category:Timeline templates|C]]
<noinclude>{{documentation}}[[Category:Timeline templates|C]][[Category:Templates that add a category]]
   
   
next up is how to get the thing to work for centuries with 1 digit and 3 digits.  Probably will use some kind of #switch. Something like #switch:{{#pos:{{PAGENAME}}|c. Then if the position of c is 5 it's a 1 digit century. if it's 7 it's a 3 digit century. and therefore the sub will have to take either the first, or the first 3 digits. </nowiki></noinclude>
next up is how to get the thing to work for centuries with 1 digit and 3 digits.  Probably will use some kind of #switch. Something like #switch:{{#pos:{{PAGENAME}}|c. Then if the position of c is 5 it's a 1 digit century. if it's 7 it's a 3 digit century. and therefore the sub will have to take either the first, or the first 3 digits. </nowiki></noinclude>

Latest revision as of 05:30, 15 October 2018

Instructions for {{CenturyNav}}
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 century, 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 century, its output can only be seen on a century page. It is impossible to reproduce its results here. If you wish to test it, go to any century and add {{timeline}} to the page.

Special note

Please remember that the word "century" should not be capitalized in the PAGENAME of any new century page that you create.

next up is how to get the thing to work for centuries with 1 digit and 3 digits. Probably will use some kind of #switch. Something like #switch:{{#pos:CenturyNav|c. Then if the position of c is 5 it's a 1 digit century. if it's 7 it's a 3 digit century. and therefore the sub will have to take either the first, or the first 3 digits. </nowiki>