Difference between revisions of "Template:Dr-make"

From blackwiki
Jump to navigation Jump to search
imported>Wbm1058
(sorry I should be working in the sandbox. revert everything except the error check)
imported>Wbm1058
(number params. for improved readability)
Line 1: Line 1:
 
<includeonly>{{#switch:{{{2}}}
 
<includeonly>{{#switch:{{{2}}}
 
   |y={{#switch:{{#expr:{{{1}}}<-729}}{{#expr:{{{1}}}<1}}{{#expr:{{{1}}}<101}}{{#expr:{{{1}}}<2100}}
 
   |y={{#switch:{{#expr:{{{1}}}<-729}}{{#expr:{{{1}}}<1}}{{#expr:{{{1}}}<101}}{{#expr:{{{1}}}<2100}}
     |1111={{drep |{{#expr:1-{{{1}}}}}| {{{3|}}}b }}
+
     |1111={{drep |1={{#expr:1-{{{1}}}}} |2={{{3|}}}b }}
     |0111={{drep |{{#expr:1-{{{1}}}}}| y{{{3|}}}b }}
+
     |0111={{drep |1={{#expr:1-{{{1}}}}} |2=y{{{3|}}}b }}
     |0011={{drep |{{{1}}}| y{{{3|}}}{{#switch:{{{3}}}|a|ya|sa|ysa|na|nsa=p}} }}
+
     |0011={{drep |1={{{1}}} |2=y{{{3|}}}{{#switch:{{{3}}}|a|ya|sa|ysa|na|nsa=p}} }}
     |0001={{drep |{{{1}}}| y{{{3|}}} }}
+
     |0001={{drep |1={{{1}}} |2=y{{{3|}}} }}
     |0000={{drep |{{{1}}}| {{{3|}}} }}
+
     |0000={{drep |1={{{1}}} |2={{{3|}}} }}
 
   }}
 
   }}
 
   |d={{#switch:{{{1}}}
 
   |d={{#switch:{{{1}}}
 
     |10|20|30|40|50|60|70|80|90|100|110|120|130|140|150|160|170|180|190|200=
 
     |10|20|30|40|50|60|70|80|90|100|110|120|130|140|150|160|170|180|190|200=
       {{drep |{{{1}}}0s| y{{{3|}}} |{{{1}}}0s (decade)}}
+
       {{drep |1={{{1}}}0s |2=y{{{3|}}} |3={{{1}}}0s (decade)}}
 
     |-11|-21|-31|-41|-51|-61|-71|-81|-91|-101|-111|-121|-131|-141|-151|-161|-171|=
 
     |-11|-21|-31|-41|-51|-61|-71|-81|-91|-101|-111|-121|-131|-141|-151|-161|-171|=
       {{drep |{{#expr:-{{{1}}}-1}}0s| y{{{3|}}}bd |{{#expr:-{{{1}}}-1}}0s}}
+
       {{drep |1={{#expr:-{{{1}}}-1}}0s |2=y{{{3|}}}bd |3={{#expr:-{{{1}}}-1}}0s}}
 
     |{{#switch:{{#expr:{{{1}}}<-180}}{{#expr:{{{1}}}<-1 }}{{#expr:{{{1}}}<0}}{{#expr:{{{1}}}<1}}{{#expr:{{{1}}}<210}}
 
     |{{#switch:{{#expr:{{{1}}}<-180}}{{#expr:{{{1}}}<-1 }}{{#expr:{{{1}}}<0}}{{#expr:{{{1}}}<1}}{{#expr:{{{1}}}<210}}
       |11111={{drep |{{#expr:-1-{{{1}}}}}0s| {{{3|}}}b }}
+
       |11111={{drep |1={{#expr:-1-{{{1}}}}}0s |2={{{3|}}}b }}
       |01111={{drep |{{#expr:-1-{{{1}}}}}0s| y{{{3|}}}b }}
+
       |01111={{drep |1={{#expr:-1-{{{1}}}}}0s |2=y{{{3|}}}b }}
       |00111={{drep |0s| y{{{3|}}}b }}
+
       |00111={{drep |1=0s |2=y{{{3|}}}b }}
       |00011={{drep |0s| y{{{3|}}} }}
+
       |00011={{drep |1=0s |2=y{{{3|}}} }}
       |00001={{drep |{{{1}}}0s| y{{{3|}}} }}
+
       |00001={{drep |1={{{1}}}0s |2=y{{{3|}}} }}
       |00000={{drep |{{{1}}}0s| {{{3|}}} }}
+
       |00000={{drep |1={{{1}}}0s |2={{{3|}}} }}
 
     }}
 
     }}
 
   }}
 
   }}
 
   |c={{#switch:{{#expr:{{{1}}}<-39}}{{#expr:{{{1}}}<1}}{{#expr:{{{1}}}<31}}
 
   |c={{#switch:{{#expr:{{{1}}}<-39}}{{#expr:{{{1}}}<1}}{{#expr:{{{1}}}<31}}
     |111={{drep |{{ordinal|{{#expr: 1-{{{1}}}}}}}&nbsp;century| {{{3|}}}b |{{ordinal|{{#expr: 1-{{{1}}}}}}} century}}
+
     |111={{drep |1={{ordinal|{{#expr: 1-{{{1}}}}}}}&nbsp;century |2={{{3|}}}b |3={{ordinal|{{#expr: 1-{{{1}}}}}}} century}}
     |011={{drep |{{ordinal|{{#expr: 1-{{{1}}}}}}}&nbsp;century| y{{{3|}}}b |{{ordinal|{{#expr: 1-{{{1}}}}}}} century}}
+
     |011={{drep |1={{ordinal|{{#expr: 1-{{{1}}}}}}}&nbsp;century |2=y{{{3|}}}b |3={{ordinal|{{#expr: 1-{{{1}}}}}}} century}}
     |001={{drep |{{ordinal|{{{1}}}}}&nbsp;century| y{{{3|}}} |{{ordinal|{{{1}}}}} century}}
+
     |001={{drep |1={{ordinal|{{{1}}}}}&nbsp;century |2=y{{{3|}}} |3={{ordinal|{{{1}}}}} century}}
     |000={{drep |{{ordinal|{{{1}}}}}&nbsp;century| {{{3|}}} |{{ordinal|{{{1}}}}} century}}
+
     |000={{drep |1={{ordinal|{{{1}}}}}&nbsp;century |2={{{3|}}} |3={{ordinal|{{{1}}}}} century}}
 
   }}
 
   }}
 
   |m={{#switch:{{#expr:{{{1}}}<-9}}{{#expr:{{{1}}}<1}}{{#expr:{{{1}}}<11}}
 
   |m={{#switch:{{#expr:{{{1}}}<-9}}{{#expr:{{{1}}}<1}}{{#expr:{{{1}}}<11}}
     |111={{drep |{{ordinal|{{#expr: 1-{{{1}}}}}}}&nbsp;millennium| {{{3|}}}b |{{ordinal|{{#expr: 1-{{{1}}}}}}} millennium}}
+
     |111={{drep |1={{ordinal|{{#expr: 1-{{{1}}}}}}}&nbsp;millennium |2={{{3|}}}b |3={{ordinal|{{#expr: 1-{{{1}}}}}}} millennium}}
     |011={{drep |{{ordinal|{{#expr: 1-{{{1}}}}}}}&nbsp;millennium| y{{{3|}}}b |{{ordinal|{{#expr: 1-{{{1}}}}}}} millennium}}
+
     |011={{drep |1={{ordinal|{{#expr: 1-{{{1}}}}}}}&nbsp;millennium |2=y{{{3|}}}b |3={{ordinal|{{#expr: 1-{{{1}}}}}}} millennium}}
     |001={{drep |{{ordinal|{{{1}}}}}&nbsp;millennium| y{{{3|}}} |{{ordinal|{{{1}}}}} millennium}}
+
     |001={{drep |1={{ordinal|{{{1}}}}}&nbsp;millennium |2=y{{{3|}}} |3={{ordinal|{{{1}}}}} millennium}}
     |000={{drep |{{ordinal|{{{1}}}}} millennium| {{{3|}}} |{{ordinal|{{{1}}}}} millennium}}
+
     |000={{drep |1={{ordinal|{{{1}}}}} millennium |2={{{3|}}} |3={{ordinal|{{{1}}}}} millennium}}
 
   }}
 
   }}
 
   |#default={{error|[[Template:Dr-make]] parameter {{param|2}} must be y, d, c, or m}}
 
   |#default={{error|[[Template:Dr-make]] parameter {{param|2}} must be y, d, c, or m}}

Revision as of 23:30, 11 July 2019

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

Usage

Produces a representation of a logically-numbered year/decade/century/millennium (first parameter). Second para is y/d/c/m. Representation style depends on the third parameter:

  • (parameter empty or absent): links to the year if it has an article (not a redirect)
  • y: always links
  • n: never links
  • t: produces simple text (no no-break spaces etc.), e.g. for use in category names
  • s: displays AD or BC in small capitals
  • a: adds AD if not BC
  • p: displays AD as prefix (only valid with a)
  • ys, ya, ysa, ns, na, nsa, sa: permitted combinations of above options
  • yap, ysap, nap, nsap, sap: combinations with AD prefix

Used by {{dr}}. Uses {{drep}}.

Examples