Difference between revisions of "Template:Seats"

From eRepublik Official Wiki
Jump to: navigation, search
m
 
(examples added; minor corrections in the code)
Line 2: Line 2:
 
<p style="width: {{{p1percent|0}}}%; background: {{{p1color|rgb(255, 201, 14)}}}; {{#ifexpr: {{{p2percent|0}}} = 0|border-radius: 5px|border-radius: 5px 0 0 5px}}; padding: 5px 0 5px 0; margin: 0; display: inline-block;">{{#ifexpr: {{{p1percent|0}}} > 0|{{{p1percent|0}}}%}}</p><p style="width: {{{p2percent|0}}}%; background: {{{p2color|rgb(239, 228, 176)}}}; {{#ifexpr: {{{p3percent|0}}} = 0|border-radius: 0 5px 5px 0;}} padding: 5px 0 5px 0; margin: 0;  display: inline-block;">{{#ifexpr: {{{p2percent|0}}} > 0|{{{p2percent|0}}}%}}</p><p style="width: {{{p3percent|0}}}%; background: {{{p3color|rgb(181, 230, 29)}}}; {{#ifexpr: {{{p4percent|0}}} = 0|border-radius: 0 5px 5px 0;}} padding: 5px 0 5px 0; margin: 0;  display: inline-block;">{{#ifexpr: {{{p3percent|0}}} > 0|{{{p3percent|0}}}%}}</p><p style="width: {{{p4percent|0}}}%; background: {{{p4color|rgb(153, 217, 234)}}}; {{#ifexpr: {{{p5percent|0}}} = 0|border-radius: 0 5px 5px 0;}} padding: 5px 0 5px 0; margin: 0;  display: inline-block;">{{#ifexpr: {{{p4percent|0}}} > 0|{{{p4percent|0}}}%}}</p><p style="width: {{{p5percent|0}}}%; background: {{{p5color|rgb(112, 146, 190)}}}; border-radius: 0 5px 5px 0; padding: 5px 0 5px 0; margin: 0;  display: inline-block;">{{#ifexpr: {{{p5percent|0}}} > 0|{{{p5percent|0}}}%}}</p>
 
<p style="width: {{{p1percent|0}}}%; background: {{{p1color|rgb(255, 201, 14)}}}; {{#ifexpr: {{{p2percent|0}}} = 0|border-radius: 5px|border-radius: 5px 0 0 5px}}; padding: 5px 0 5px 0; margin: 0; display: inline-block;">{{#ifexpr: {{{p1percent|0}}} > 0|{{{p1percent|0}}}%}}</p><p style="width: {{{p2percent|0}}}%; background: {{{p2color|rgb(239, 228, 176)}}}; {{#ifexpr: {{{p3percent|0}}} = 0|border-radius: 0 5px 5px 0;}} padding: 5px 0 5px 0; margin: 0;  display: inline-block;">{{#ifexpr: {{{p2percent|0}}} > 0|{{{p2percent|0}}}%}}</p><p style="width: {{{p3percent|0}}}%; background: {{{p3color|rgb(181, 230, 29)}}}; {{#ifexpr: {{{p4percent|0}}} = 0|border-radius: 0 5px 5px 0;}} padding: 5px 0 5px 0; margin: 0;  display: inline-block;">{{#ifexpr: {{{p3percent|0}}} > 0|{{{p3percent|0}}}%}}</p><p style="width: {{{p4percent|0}}}%; background: {{{p4color|rgb(153, 217, 234)}}}; {{#ifexpr: {{{p5percent|0}}} = 0|border-radius: 0 5px 5px 0;}} padding: 5px 0 5px 0; margin: 0;  display: inline-block;">{{#ifexpr: {{{p4percent|0}}} > 0|{{{p4percent|0}}}%}}</p><p style="width: {{{p5percent|0}}}%; background: {{{p5color|rgb(112, 146, 190)}}}; border-radius: 0 5px 5px 0; padding: 5px 0 5px 0; margin: 0;  display: inline-block;">{{#ifexpr: {{{p5percent|0}}} > 0|{{{p5percent|0}}}%}}</p>
  
<div style="font-weight: normal; text-align: left;">{{#ifeq: {{{key|}}}|1|{{User:VSkyzv/Template:Congress/Key|p1color={{{p1color|}}}|p2color={{{p2color|}}}|p3color={{{p3color|}}}|p4color={{{p4color|}}}|p5color={{{p5color|}}}|p1={{{p1|}}}|p2={{{p2|}}}|p3={{{p3|}}}|p4={{{p4|}}}|p5={{{p5|}}}|seats={{{seats|}}}}}}}
+
<div style="font-weight: normal; text-align: left;">{{#ifeq: {{{key|}}}|1|{{Seats/Key|p1color={{{p1color|}}}|p2color={{{p2color|}}}|p3color={{{p3color|}}}|p4color={{{p4color|}}}|p5color={{{p5color|}}}|p1={{{p1|}}}|p2={{{p2|}}}|p3={{{p3|}}}|p4={{{p4|}}}|p5={{{p5|}}}|seats={{{seats|}}}}}}}
  
{{#ifexpr: {{{p5percent|0}}} = 0|{{User:vSkyzv/Template:Congress/NoSeat}}}}</div></div></includeonly>
+
{{#ifexpr: {{{p5percent|0}}} = 0|{{Seats/NoSeat}}}}</div></div></includeonly>
  
<noinclude>{{Complex}}
+
<noinclude>{{Complex}}{{-}}{{TOCright}}
 +
'''This template is used to visually show the Congress representation.''' Below you can see the usage, code samples and examples of this code samples.
  
:<div class="noprint relarticle mainarticle">''If you are a editor and would like a breakdown of this template's complex code, please see [[Template talk:Seats]]''</div>
+
:''If you are an editor and would like a breakdown of this template's complex code, please see [[Template talk:Seats]]''
  
'''For optimal use''', please arrange the parties in descending order by amount of votes, such that the party that gets 50% of the vote is Party 1, the party that gets 40% of the vote is Party 2, and so forth.
+
==Usage==
==Sample Code==
+
'''For optimal use''', please arrange the parties in descending order by the number of votes, such that the party that gets 50% of the vote is Party 1, the party that gets 40% of the vote is Party 2, and so forth.  
<pre>{{Seats|
+
 
 +
Following is the usage with information about each parameter. For clean usage, scroll down to [[#Clean usage]].
 +
 
 +
<!-- CURRENTLY NOT WORKING; omitted from the list below;
 +
  seats= | Set "seats" to the number of total seats decided in the election to display it in the key. -->
 +
<pre>
 +
{{Seats|
 +
  key=1| <!-- OPTIONAL: Set "key" to 1 to display the key underneath the bar -->.
 +
  width=| <!-- OPTIONAL: Set "width" to a custom value (numbers only, no % or px since the template automatically uses px) to set the graph to a custom width. If not used; 800 is predefined; -->
 +
 
 +
  p1=First party name| <!-- party name with largest number of Congress seats. OPTIONAL if you don't use key=1 -->
 +
  p1percent=40| <!-- put percentage number for the party with largest number of Congress seats -->
 +
  p1color=#5D8AA8| <!-- OPTIONAL: bar color code for the party with largest number of Congress seats -->
 +
  p2=Second party name| <!-- party name with second largest number of Congress seats. OPTIONAL if you don't use key=1 -->
 +
  p2percent=30| <!-- put percentage number for the party with second largest number of Congress seats -->
 +
  p2color=#F0F8FF| <!-- OPTIONAL: bar color code for the party with second largest number of Congress seats -->
 +
  p3=Third party name| <!-- party name with third largest number of Congress seats. OPTIONAL if you don't use key=1 -->
 +
  p3percent=20| <!-- put percentage number for the party with third largest number of Congress seats -->
 +
  p3color=#E32636| <!-- OPTIONAL: bar color code for the party with third largest number of Congress seats -->
 +
  p4=Fourth party name| <!-- party name with fourth largest number of Congress seats. OPTIONAL if you don't use key=1 -->
 +
  p4percent=12| <!-- put percentage number for the party with fourth largest number of Congress seats -->
 +
  p4color=#EFDECD| <!-- OPTIONAL: bar color code for the party with fourth largest number of Congress seats -->
 +
  p5=Fifth party name| <!-- party name with fifth largest number of Congress seats. OPTIONAL if you don't use key=1 -->
 +
  p5percent=8| <!-- put percentage number for the party with fifth largest number of Congress seats -->
 +
  p5color=#E52B50| <!-- OPTIONAL: bar color code for the party with fifth largest number of Congress seats -->
 +
}}
 +
</pre>
 +
 
 +
Note regarding color: '''Color names, #000000, or rgb(255, 255, 255) may be used. If no color is specified, default colors are used:'''
 +
 
 +
{{/Key|
 +
  p1color=#FFC90E|
 +
  p2color=#EFE4B0|
 +
  p3color=#B5E61D|
 +
  p4color=#99D9EA|
 +
  p5color=#7092BE|
 +
}}
 +
 
 +
==Clean usage==
 +
<pre>
 +
{{Seats|
 
   key=1|
 
   key=1|
 +
  width=|
  
   p1=Progressive Party|
+
   p1=|
   p1percent=30|
+
   p1percent=|
   p2=Moderate Party|
+
  p1color=|
   p2percent=40|
+
   p2=|
   p3=Conservative Party|
+
   p2percent=|
 +
  p2color=|
 +
   p3=|
 +
  p3percent=|
 +
  p3color=|
 +
  p4=|
 +
  p4percent=|
 +
  p4color=|
 +
  p5=|
 +
  p5percent=|
 +
  p5color=|
 +
}}
 +
</pre>
 +
 
 +
==Sample Code with examples==
 +
===Sample 1===
 +
No party names, no specific codes. Only the percentages used and width decreased.
 +
 
 +
<pre>{{Seats|
 +
  width=400|
 +
  p1percent=40|
 +
  p2percent=30|
 
   p3percent=12|
 
   p3percent=12|
  p4=Communist Party|
 
 
   p4percent=10|
 
   p4percent=10|
  p5=Fascist Party|
 
 
   p5percent=8|
 
   p5percent=8|
 
}}</pre>
 
}}</pre>
Set "key" to 1 to display and 0 to hide.
 
Set "seats" to the number of total seats decided in the election to display it in the key.
 
Set "width" to a custom value (numbers only, no % or px since the template automatically uses px) to set the graph to a custom width.
 
  
<pre>{{Seats|
+
{{Seats|
   key=1|
+
   width=400|
 
+
   p1percent=40|
  p1=Worker's Party|
+
   p2percent=30|
   p1percent=30|
+
  p1color=#5D8AA8|
+
  p2=Green Party|
+
   p2percent=40|
+
  p2color=#F0F8FF|
+
  p3=Centrist Party|
+
 
   p3percent=12|
 
   p3percent=12|
  p3color=#E32636|
 
  p4=Pacifist Party|
 
 
   p4percent=10|
 
   p4percent=10|
  p4color=#EFDECD|
 
  p5=Corporate Party|
 
 
   p5percent=8|
 
   p5percent=8|
  p5color=#E52B50|
+
}}
}}</pre>
+
If no color is specified, default colors are used. Color names, #000000, or rgb(255, 255, 255) may be used.
+
  
==Example==
+
===Sample 2===
{{Seats|
+
Full list with not-linkable fake parties. This is completely made-up example.
 +
<pre>{{Seats|
 
   key=1|
 
   key=1|
  
 
   p1=Progressive Party|
 
   p1=Progressive Party|
   p1percent=30|
+
   p1percent=40|
 +
  p1color=#766|
 
   p2=Moderate Party|
 
   p2=Moderate Party|
   p2percent=40|
+
   p2percent=30|
 +
  p2color=#888|
 
   p3=Conservative Party|
 
   p3=Conservative Party|
   p3percent=12|
+
   p3percent=20|
 +
  p3color=#900|
 
   p4=Communist Party|
 
   p4=Communist Party|
 
   p4percent=10|
 
   p4percent=10|
 +
  p4color=#877|
 
   p5=Fascist Party|
 
   p5=Fascist Party|
   p5percent=8|
+
   p5percent=0|
}}
+
  p5color=#999|
 +
}}</pre>
  
 
{{Seats|
 
{{Seats|
   key=0|
+
   key=1|
  
 
   p1=Progressive Party|
 
   p1=Progressive Party|
   p1percent=30|
+
   p1percent=40|
 +
  p1color=#766|
 
   p2=Moderate Party|
 
   p2=Moderate Party|
   p2percent=40|
+
   p2percent=30|
 +
  p2color=#888|
 
   p3=Conservative Party|
 
   p3=Conservative Party|
   p3percent=12|
+
   p3percent=20|
 +
  p3color=#900|
 
   p4=Communist Party|
 
   p4=Communist Party|
 
   p4percent=10|
 
   p4percent=10|
 +
  p4color=#877|
 
   p5=Fascist Party|
 
   p5=Fascist Party|
   p5percent=8|
+
   p5percent=0|
 +
  p5color=#999|
 
}}
 
}}
  
{{Seats|
+
===Sample 3===
 +
Full list with linkable parties. This example is taken from [[Congress of the Netherlands]] article; September 2011 elections.
 +
<pre>{{Seats|
 
   key=1|
 
   key=1|
 +
  p1=[[Democratisch Nederland]]|
 +
  p1percent=42.5|
 +
  p1color=#3333cc|
 +
  p2=[[Geuzen Partij Nederland]]|
 +
  p2percent=25|
 +
  p2color=#C9C5DE|
 +
  p3=[[Iron & Wine]]|
 +
  p3percent=22.5|
 +
  p3color=#ffcc33|
 +
  p4=[[Centre-Left Netherlands]]|
 +
  p4percent=5|
 +
  p4color=#d82000|
 +
  p5=Rote Armee Fraktion|
 +
  p5percent=5|
 +
  p5color=#9d4e40|
 +
}}</pre>
  
   p1=Worker's Party|
+
{{Seats|
   p1percent=30|
+
  key=1|
   p1color=#5D8AA8|
+
   p1=[[Democratisch Nederland]]|
   p2=Green Party|
+
   p1percent=42.5|
   p2percent=40|
+
   p1color=#3333cc|
   p2color=#F0F8FF|
+
   p2=[[Geuzen Partij Nederland]]|
   p3=Centrist Party|
+
   p2percent=25|
   p3percent=12|
+
   p2color=#C9C5DE|
   p3color=#E32636|
+
   p3=[[Iron & Wine]]|
   p4=Pacifist Party|
+
   p3percent=22.5|
   p4percent=10|
+
   p3color=#ffcc33|
   p4color=#EFDECD|
+
   p4=[[Centre-Left Netherlands]]|
   p5=Corporate Party|
+
   p4percent=5|
   p5percent=8|
+
   p4color=#d82000|
   p5color=#E52B50|
+
   p5=Rote Armee Fraktion|
}}
+
   p5percent=5|
 
+
   p5color=#9d4e40|
===Sandbox===
+
}}</noinclude>
{{/Key|
+
  p1color=#5D8AA8|
+
  p2color=#F0F8FF|
+
  p3color=#E32636|
+
  p4color=#EFDECD|
+
  p5color=#E52B50|
+
}}
+
{{/Key|p1color=#111|p2color=#333|p3color=#555|p4color=#777|p5color=#999|}}
+
</noinclude>
+

Revision as of 14:57, 3 June 2020


edit

Complex.png Complex template

The code of this template is really complex, please use your sandbox before editing this template


This template is used to visually show the Congress representation. Below you can see the usage, code samples and examples of this code samples.

If you are an editor and would like a breakdown of this template's complex code, please see Template talk:Seats

Usage

For optimal use, please arrange the parties in descending order by the number of votes, such that the party that gets 50% of the vote is Party 1, the party that gets 40% of the vote is Party 2, and so forth.

Following is the usage with information about each parameter. For clean usage, scroll down to #Clean usage.

{{Seats|
  key=1| <!-- OPTIONAL: Set "key" to 1 to display the key underneath the bar -->.
  width=| <!-- OPTIONAL: Set "width" to a custom value (numbers only, no % or px since the template automatically uses px) to set the graph to a custom width. If not used; 800 is predefined; -->

  p1=First party name| <!-- party name with largest number of Congress seats. OPTIONAL if you don't use key=1 -->
  p1percent=40| <!-- put percentage number for the party with largest number of Congress seats -->
  p1color=#5D8AA8| <!-- OPTIONAL: bar color code for the party with largest number of Congress seats --> 
  p2=Second party name| <!-- party name with second largest number of Congress seats. OPTIONAL if you don't use key=1 -->
  p2percent=30| <!-- put percentage number for the party with second largest number of Congress seats -->
  p2color=#F0F8FF| <!-- OPTIONAL: bar color code for the party with second largest number of Congress seats --> 
  p3=Third party name| <!-- party name with third largest number of Congress seats. OPTIONAL if you don't use key=1 --> 
  p3percent=20| <!-- put percentage number for the party with third largest number of Congress seats -->
  p3color=#E32636| <!-- OPTIONAL: bar color code for the party with third largest number of Congress seats --> 
  p4=Fourth party name| <!-- party name with fourth largest number of Congress seats. OPTIONAL if you don't use key=1 -->
  p4percent=12| <!-- put percentage number for the party with fourth largest number of Congress seats -->
  p4color=#EFDECD| <!-- OPTIONAL: bar color code for the party with fourth largest number of Congress seats --> 
  p5=Fifth party name| <!-- party name with fifth largest number of Congress seats. OPTIONAL if you don't use key=1 -->
  p5percent=8| <!-- put percentage number for the party with fifth largest number of Congress seats -->
  p5color=#E52B50| <!-- OPTIONAL: bar color code for the party with fifth largest number of Congress seats --> 
}}

Note regarding color: Color names, #000000, or rgb(255, 255, 255) may be used. If no color is specified, default colors are used:

Key:


Clean usage

{{Seats|
  key=1|
  width=|

  p1=|
  p1percent=|
  p1color=|
  p2=|
  p2percent=|
  p2color=|
  p3=|
  p3percent=|
  p3color=|
  p4=|
  p4percent=|
  p4color=|
  p5=|
  p5percent=|
  p5color=|
}}

Sample Code with examples

Sample 1

No party names, no specific codes. Only the percentages used and width decreased.

{{Seats|
  width=400|
  p1percent=40|
  p2percent=30|
  p3percent=12|
  p4percent=10|
  p5percent=8|
}}

40%

30%

12%

10%

8%


Sample 2

Full list with not-linkable fake parties. This is completely made-up example.

{{Seats|
  key=1|

  p1=Progressive Party|
  p1percent=40|
  p1color=#766|
  p2=Moderate Party|
  p2percent=30|
  p2color=#888|
  p3=Conservative Party|
  p3percent=20|
  p3color=#900|
  p4=Communist Party|
  p4percent=10|
  p4color=#877|
  p5=Fascist Party|
  p5percent=0|
  p5color=#999|
}}

40%

30%

20%

10%

Key:

Progressive Party

Moderate Party

Conservative Party

Communist Party

Fascist Party
Note: One or more parties received no seats in this elections.


Sample 3

Full list with linkable parties. This example is taken from Congress of the Netherlands article; September 2011 elections.

{{Seats|
  key=1|
  p1=[[Democratisch Nederland]]|
  p1percent=42.5|
  p1color=#3333cc|
  p2=[[Geuzen Partij Nederland]]|
  p2percent=25|
  p2color=#C9C5DE|
  p3=[[Iron & Wine]]|
  p3percent=22.5|
  p3color=#ffcc33|
  p4=[[Centre-Left Netherlands]]|
  p4percent=5|
  p4color=#d82000|
  p5=Rote Armee Fraktion|
  p5percent=5|
  p5color=#9d4e40|
}}

42.5%

25%

22.5%

5%

5%