Difference between revisions of "Template: Date"

From A Wiki of Ice and Fire
Jump to: navigation, search
(linking to specific date article if it exists)
m (fixing links to existing BC and AC-AC articles)
Line 1: Line 1:
 
<includeonly>{{#switch:{{#ifexpr: {{{1|}}} >= 0 |a}}{{#ifexpr: {{{1|}}} < 0 |b}}{{#if: {{{2|}}} |{{#ifexpr: {{{2}}} >= 0 |a}}{{#ifexpr: {{{2}}} < 0 |b}}}}
 
<includeonly>{{#switch:{{#ifexpr: {{{1|}}} >= 0 |a}}{{#ifexpr: {{{1|}}} < 0 |b}}{{#if: {{{2|}}} |{{#ifexpr: {{{2}}} >= 0 |a}}{{#ifexpr: {{{2}}} < 0 |b}}}}
 
| a = {{#ifexist:{{{1}}} AC|[[{{{1}}} AC]]|[[Years after Aegon's Conquest#Year {{{1}}} After the Conquest|{{{1}}} AC]]}}
 
| a = {{#ifexist:{{{1}}} AC|[[{{{1}}} AC]]|[[Years after Aegon's Conquest#Year {{{1}}} After the Conquest|{{{1}}} AC]]}}
| b = {{#ifexist:{{{1}}} BC|[[{{{1}}} BC]]|[[Years before Aegon's Conquest#Year {{#expr:-{{{1}}}}} Before the Conquest|{{#expr:-{{{1}}}}} BC]]}}
+
| b = {{#ifexist:{{#expr:-{{{1}}}}} BC|[[{{#expr:-{{{1}}}}} BC]]|[[Years before Aegon's Conquest#Year {{#expr:-{{{1}}}}} Before the Conquest|{{#expr:-{{{1}}}}} BC]]}}
| aa = {{#ifexist:{{{1}}} AC|[[{{{1}}} AC]]|[[Years after Aegon's Conquest#Year {{{1}}} After the Conquest|{{{1}}}]]}}&ndash;{{#ifexist:{{{2}}} AC|[[{{{2}}} AC]]|[[Years after Aegon's Conquest#Year {{{2}}} After the Conquest|{{{2}}} AC]]}}
+
| aa = {{#ifexist:{{{1}}} AC|[[{{{1}}} AC|{{{1}}}]]|[[Years after Aegon's Conquest#Year {{{1}}} After the Conquest|{{{1}}}]]}}&ndash;{{#ifexist:{{{2}}} AC|[[{{{2}}} AC]]|[[Years after Aegon's Conquest#Year {{{2}}} After the Conquest|{{{2}}} AC]]}}
| ba = {{#ifexist:{{{1}}} BC|[[{{{1}}} BC]]|[[Years before Aegon's Conquest#Year {{#expr:-{{{1}}}}} Before the Conquest|{{#expr:-{{{1}}}}}&#32;BC]]}} &ndash; {{#ifexist:{{{2}}} AC|[[{{{2}}} AC]]|[[Years after Aegon's Conquest#Year {{{2}}} After the Conquest|{{{2}}}&#32;AC]]}}
+
| ba = {{#ifexist:{{#expr:-{{{1}}}}} BC|[[{{#expr:-{{{1}}}}} BC]]|[[Years before Aegon's Conquest#Year {{#expr:-{{{1}}}}} Before the Conquest|{{#expr:-{{{1}}}}}&#32;BC]]}} &ndash; {{#ifexist:{{{2}}} AC|[[{{{2}}} AC]]|[[Years after Aegon's Conquest#Year {{{2}}} After the Conquest|{{{2}}}&#32;AC]]}}
| bb = {{#ifexist:{{{1}}} BC|[[{{{1}}} BC]]|[[Years before Aegon's Conquest#Year {{#expr:-{{{1}}}}} Before the Conquest|{{#expr:-{{{1}}}}}]]}}&ndash;{{#ifexist:{{{2}}} BC|[[{{{2}}} BC]]|[[Years before Aegon's Conquest#Year {{#expr:-{{{2}}}}} Before the Conquest|{{#expr:-{{{2}}}}} BC]]}}
+
| bb = {{#ifexist:{{#expr:-{{{1}}}}} BC|[[{{#expr:-{{{1}}}}} BC|{{#expr:-{{{1}}}}}]]|[[Years before Aegon's Conquest#Year {{#expr:-{{{1}}}}} Before the Conquest|{{#expr:-{{{1}}}}}]]}}&ndash;{{#ifexist:{{#expr:-{{{2}}}}} BC|[[{{#expr:-{{{2}}}}} BC]]|[[Years before Aegon's Conquest#Year {{#expr:-{{{2}}}}} Before the Conquest|{{#expr:-{{{2}}}}} BC]]}}
|{{#if:{{{1|}}}|[[Years after Aegon's Conquest#Year {{{1}}} After the Conquest|{{{1}}}{{#if:{{{2|}}}||&#32;AC}}]]{{#if:{{{2|}}}|&ndash;[[Years after Aegon's Conquest#Year {{{2}}} After the Conquest|{{{2}}} AC]]}}}}[[Category:Articles with broken date templates]]
+
|{{#if:{{{1|}}}|[[Years after Aegon's Conquest#Year {{{1}}} After the Conquest|{{{1}}}{{#if:{{{2|}}}||&#32;AC}}]]{{#if:{{{2|}}}|&ndash;[[Years after Aegon's Conquest#Year {{{2}}} After the Conquest|{{{2}}}&#32;AC]]}}}}[[Category:Articles with broken date templates]]
 
}}</includeonly><noinclude>{{documentation}}</noinclude>
 
}}</includeonly><noinclude>{{documentation}}</noinclude>

Revision as of 11:59, 12 May 2019

Template documentation[view] [edit] [history] [purge]

This template links to a year's relevant article. It should speed up the editing process and make the text more readable when editing.

This template first tries to link to a year's dedicated article (e.g. 300 AC), but if that article doesn't exist the template links to the relevant section of either Years after Aegon's Conquest or Years before Aegon's Conquest.

Usage

One year

{{Date|#}} where # denotes the number of the year. Years before Aegon's Conquest must be prefixed with a negative sign -.

For example, {{Date|300}} results in "300 AC", but {{Date|-300}} results in "300 BC".

Two years

{{Date|from #|to #}}

When two years are given, the template returns a range.

For example, {{Date|283|298}} results in "283298 AC", and {{Date|-283|298}} results in "283 BC – 298 AC".

As a special case, if the second argument is + the range spans up to the present. Example: {{Date|200|+}} results in "200 AC – Present".