Wikipedia:Lua/Modul/Partei/en

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen
Vorlagenprogrammierung Diskussionen Lua Unterseiten
Modul Deutsch English

Modul: Dokumentation

Partei – This module has got three aims:

  • given a political party fullname or an alternative name (alias) – with or without wikilinks – or the acronym (short name) of a political party and the nationality, the module returns:
  • the color code which has been assigned to that party, in particular the standard color (→ p.farbe) or, eventually, the alternative color (→ p.alt);
  • the light color code – it is obtained through a standard or a customized coefficient of opacity, which is applied to the standard color code or, eventually, to the alternative color code (or, if the party's name should not be specified, to a particular color code) (→ p.hell);
  • the module uses the color code to build:
  • two adjacent table cells: a colored cell with the party's color – standard or alternative color – and a cell with the party's name (→ p.parteinamefarbe);
  • a table cell with the party's name and a colored bottom border with the party's color – standard or alternative color – (→ p.parteifarbezeile);
  • a colored table cell with the party's color – standard, alternative, light or light alternative color – (→ p.parteifarbezelle);
  • given the acronym (short name) and the nationality of a political party, the module returns the party's fullname with wikilinks, in particular the fullname as link target and the acronym (short name) as link label, and, in special cases, a sequence of parties with wikilinks (→ p.pipelink).

Functions for templates[Quelltext bearbeiten]

  • farbe
Parameter
1
Political party fullname or alternative name. Otherwise acronym/short name: in this last case, see parameter 2.
2
This parameter must be used only if an acronym (or a short name) has been used as value of the parameter 1
Nationality (ISO-3166-1-Kodierliste, ALPHA-2).
Result
Color code (HEX code): standard color.
↘ If the requested party is not included in the liste, the result is DABAD0.
Example
1. Party full name:
{{#invoke:Partei|farbe|Piratenpartei Deutschland}} yields FF820A
2. Party alternative name:
{{#invoke:Partei|farbe|Piratenpartei Berlin}} yields FF820A, which is the same color of Piratenpartei Deutschland, because Piratenpartei Berlin is an alias of Piratenpartei Deutschland.
3. Acronym/short name:
{{#invoke:Partei|farbe|PIRATEN|DE}} yields FF820A
  • alt
Parameter
1
Political party fullname or alternative name. Otherwise acronym/short name: in this last case, see parameter 2.
2
This parameter must be used only if an acronym (or a short name) has been used as value of the parameter 1
Nationality (ISO-3166-1-Kodierliste, ALPHA-2).
Result
Color code (HEX code): alternative color. The alternative color can be: 1) a second color; 2) a color which had been used by the party in the past.
↘ If the requested party is not included in the liste, the result is DABAD0.
Example
1. Party full name:
{{#invoke:Partei|farbe|Piratenpartei Deutschland|V=A}} yields FF820A
2. Party alternative name:
{{#invoke:Partei|farbe|Piratenpartei Berlin|V=A}} yields FF820A, which is the same alternative color of Piratenpartei Deutschland.
3. Acronym/short name:
{{#invoke:Partei|farbe|PIRATEN|DE|V=A}} yields FF820A
  • hell
Parameters
1
Political party fullname or alternative name. Otherwise acronym/short name: in this last case, see parameter 2.
2
This parameter must be used only if an acronym (or a short name) has been used as value of the parameter 1
Nationality (ISO-3166-1-Kodierliste, ALPHA-2).
V
Optional parameter
Variant. If this parameter is compiled with the value A, the alternative color code is shown.
col
Optional parameter
If this parameter is compiled with a HEX color code, the coefficient of opacity is applied to this code instead of to the party's color code (→ support to Vorlage:Parlamentswahl, Jahralt, optionale Farben).
h
Optional parameter
Value of opacity. This value is a number lying between 0 and 1 (i.e. 0.8, 0.24). For example, h = 0.6 applies to a party color an opacity equal to 60 % of the original opacity.
The default value is 0.2 (opacity = 20 %).
Result
Color code (HEX code): light standard color or light alternative color. If the parameter col has been used and a HEX code has been written as value, the result is a lighter color.
↘ If the requested party is not included in the liste, the result is F8F2F6.
Examples:
1. Party full name:
1.1. Light standard color:
1.1.1 Standard opacity
{{#invoke:Partei|hell|Piratenpartei Deutschland}} yields FFE6CE
1.1.2 Optional opacity
{{#invoke:Partei|hell|Piratenpartei Deutschland|h=0.6}} yields FFB46C
1.2. Light alternative color:
1.2.1 Standard opacity
{{#invoke:Partei|hell|Piratenpartei Deutschland|V=A}} yields CCCCCC
1.2.2 Optional opacity
{{#invoke:Partei|hell|Piratenpartei Deutschland|V=A|h=0.6}} yields 666666
2. Party alternative name:
2.1. Light standard color:
2.1.1 Standard opacity
{{#invoke:Partei|hell|Piratenpartei Berlin}} yields FFE6CE
2.1.2 Optional opacity
{{#invoke:Partei|hell|Piratenpartei Berlin|h=0.6}} yields FFB46C
2.2. Light alternative color:
2.2.1 Standard opacity
{{#invoke:Partei|hell|Piratenpartei Berlin|V=A}} yields CCCCCC
2.2.2 Optional opacity
{{#invoke:Partei|hell|Piratenpartei Berlin|V=A|h=0.6}} yields 666666
3. Acronym/short name:
3.1. Light standard color:
3.1.1 Standard opacity
{{#invoke:Partei|hell|PIRATEN|DE}} yields FFE6CE
3.1.2 Optional opacity
{{#invoke:Partei|hell|PIRATEN|DE|h=0.6}} yields FFB46C
3.2. Light alternative color:
3.2.1 Standard opacity
{{#invoke:Partei|hell|PIRATEN|DE|V=A}} yields CCCCCC
3.2.2 Optional opacity
{{#invoke:Partei|hell|PIRATEN|DE|V=A|h=0.6}} yields 666666
4. Color code
4.1. Standard opacity
{{#invoke:Partei|hell|col=000000}} yields CCCCCC
4.2. Optional opacity
{{#invoke:Partei|hell|col=000000|h=0.6}} yields 666666
  • parteinamefarbe
Parameter
1
Political party fullname or alternative name. Otherwise acronym/short name: in this last case, see parameter 2.
2
This parameter must be used only if an acronym (or a short name) has been used as value of the parameter 1
Nationality (ISO-3166-1-Kodierliste, ALPHA-2).
V
Optional parameter
Variant. If this parameter is compiled with the value A, the alternative color code is shown.
rowspan
Optional parameter
If this parameter is compiled with a positive numeric value, the cell with the color and the cell with the party's name stretch over two or more rows.
colspan
Optional parameter
If this parameter is compiled with a positive numeric value, the cell with the party's name stretches over two or more columns.
Result
Two adjacent table cells: a cell with the party's color – standard or alternative color – and a cell with the name of the same party.
If the acronym and the nationality are used, the acronym (without wikilinks) is shown as party's name.
Styles. The style text-align:left is predefined and cannot be overwritten. Other styles (for example: font-size) can be included only in the table's styles (for example: {| class="wikitable" style="font-size:90%").
↘ If the requested party is not included in the liste, the result is DABAD0 (colour) + the same party.
Examples:
1.Fullname (with/without wikilinks)
{{#invoke:Partei|parteinamefarbe|[[Piratenpartei Deutschland|PIRATEN]]}}
{{#invoke:Partei|parteinamefarbe|[[Piratenpartei Deutschland|PIRATEN]]|V=A}}
{{#invoke:Partei|parteinamefarbe|Piratenpartei Deutschland}}
{{#invoke:Partei|parteinamefarbe|Piratenpartei Deutschland|V=A}}
2. Acronym/Short name + State
{{#invoke:Partei|parteinamefarbe|PIRATEN|DE}}
{{#invoke:Partei|parteinamefarbe|PIRATEN|DE|V=A}}
3. Rowspan/colspan
{{#invoke:Partei|parteinamefarbe|[[Piratenpartei Deutschland|PIRATEN]]|rowspan=3}}
{{#invoke:Partei|parteinamefarbe|[[Piratenpartei Deutschland|PIRATEN]]|V=A|colspan=3}}
{{#invoke:Partei|parteinamefarbe|PIRATEN|DE|V=A|colspan=3}}
  • parteifarbezeile
Parameters
1
Political party fullname or alternative name. Otherwise acronym/short name: in this last case, see parameter 2.
2
This parameter must be used only if an acronym (or a short name) has been used as value of the parameter 1
Nationality (ISO-3166-1-Kodierliste, ALPHA-2).
V
Optional parameter
Variant. If this parameter is compiled with the value A, the alternative color code is shown.
k
Optional parameter
This parameter can be compiled with a specific name (for example, with name of a candidate): in this case, the cell shows this specific name instead of the party's name.
w
Optional parameter
Width. This parameter can be compiled with a numeric value to customize the cell's width.
rowspan
Optional parameter
If this parameter is compiled with a positive numeric value, the cell with the party's name and the color stretches over two or more rows.
colspan
Optional parameter
If this parameter is compiled with a positive numeric value, the cell with the party's name and the color stretches over two or more columns.
Result
A table cell with the name of the party and a colored bottom border with the party's color – standard or alternative color.
If the acronym and the nationality are used, the acronym (without wikilinks) is shown as party's name.
Styles. They can be included only in the table's styles (for example: {| class="wikitable" style="font-size:90%").
↘ If the requested party is not included in the liste, the result is DABAD0 (colour) + the same party.
Examples:
1. Fullname (with/without wikilinks)
{{#invoke:Partei|parteifarbezeile|[[Piratenpartei Deutschland|PIRATEN]]}}
{{#invoke:Partei|parteifarbezeile|[[Piratenpartei Deutschland|PIRATEN]]|V=A}}
{{#invoke:Partei|parteifarbezeile|Piratenpartei Deutschland}}
{{#invoke:Partei|parteifarbezeile|Piratenpartei Deutschland|V=A}}
2. Acronym/Short name + State
{{#invoke:Partei|parteifarbezeile|PIRATEN|DE}}
{{#invoke:Partei|parteifarbezeile|PIRATEN|DE|V=A}}
3. Alternative Name
{{#invoke:Partei|parteifarbezeile|Piratenpartei Deutschland|k=[[Patrick Schiffer|Schiffer]]}}
{{#invoke:Partei|parteifarbezeile|PIRATEN|DE|k=[[Patrick Schiffer|Schiffer]]}}
4. Width
{{#invoke:Partei|parteifarbezeile|PIRATEN|DE|w=300}}
{{#invoke:Partei|parteifarbezeile|PIRATEN|DE|k=[[Patrick Schiffer|Schiffer]]|w=300|V=A}}
5. Rowspan/colspan
{{#invoke:Partei|parteifarbezeile|[[Piratenpartei Deutschland|PIRATEN]]|rowspan=3}}
{{#invoke:Partei|parteifarbezeile|[[Piratenpartei Deutschland|PIRATEN]]|V=A|colspan=3}}
{{#invoke:Partei|parteifarbezeile|PIRATEN|DE|V=A|colspan=3}}
  • parteifarbezelle
Parameters
1
Political party fullname or alternative name (wikilinks are useless in this case, even if the function is in any case available). Otherwise acronym/short name: in this last case, see parameter 2.
2
This parameter must be used only if an acronym (or a short name) has been used as value of the parameter 1
Nationality (ISO-3166-1-Kodierliste, ALPHA-2).
V
Optional parameter
Variant. This parameter can be compiled with three values:
  • A: the alternative color code is shown;
  • H: the lighter standard color code is shown;
  • HA: the lighter alternative color code is shown.
rowspan
Optional parameter
If this parameter is compiled with a positive numeric value, the cell with the color stretches over two or more rows.
|
↳ The string must end with a vertical bar.
Result
A colored table cell with the party's color – standard, alternative, light or light alternative color.
Styles. They can be included only in the table's styles (for example: {| class="wikitable" style="text-align:center").
↘ If the requested party is not included in the liste, the result is DABAD0.
Examples:
1. Party full name:
{{#invoke:Partei|parteifarbezelle|Piratenpartei Deutschland}}|
{{#invoke:Partei|parteifarbezelle|Piratenpartei Deutschland|V=A}}|
{{#invoke:Partei|parteifarbezelle|Piratenpartei Deutschland|V=H}}|
{{#invoke:Partei|parteifarbezelle|Piratenpartei Deutschland|DE|V=HA}}|
2. Acronym/short name + State:
{{#invoke:Partei|parteifarbezelle|PIRATEN|DE}}|
{{#invoke:Partei|parteifarbezelle|PIRATEN|DE|V=A}}|
{{#invoke:Partei|parteifarbezelle|PIRATEN|DE|V=H}}|
{{#invoke:Partei|parteifarbezelle|PIRATEN|DE|V=HA}}|
3. Rowspan:
{{#invoke:Partei|parteifarbezelle|PIRATEN|DE|V=A|rowspan=3}}|
  • pipelink
Parameter
1
Acronym/short name
2
Nationality (ISO-3166-1-Kodierliste, ALPHA-2). In any case, only two characters must be used.
Result
Party fullname with acronym and wikilinks (piped links).
The module can return a sequence of parties with wikilinks (support to Vorlage:Parlamentswahl/Parteinamen).
↘ If the requested party is not included in the liste, the result is the same acronym/short name.
Example
{{#invoke:Partei|pipelink|CDU|DE}} yields CDU (i.e. [[Christlich Demokratische Union Deutschlands|CDU]])
{{#invoke:Partei|pipelink|ABCDEF|DE}} yields ABCDEF
{{#invoke:Partei|pipelink|PSC/CVP|BE}} yields:
PSC/
CVP
(i.e. [[Centre Démocrate Humaniste|CDH]]/<br/>[[Christen-Democratisch en Vlaams|CVP]])

Party names[Quelltext bearbeiten]

See Module:Partei/Liste

Table values[Quelltext bearbeiten]

partei.info={
     ...
     ["Piratenpartei Deutschland"]={"FF820A", "DEU", "000000"},
     ...
     }

There are two or three values stored for each party, respectively:

  1. required value – the color of the party (HEX code);
  2. required value – the nationality, or the nationalities (ISO-3166-1-Kodierliste, ALPHA-2) – this information is used only in the list of the political parties;
  3. optional value – an eventual alternative color of the party (HEX code), i. e. a second color or a color which had been used by the party in the past.

Alternative names[Quelltext bearbeiten]

The altname group contains the alternate names of a party (Landesverbände, old names). The following is an example of alternate name for the Sozialdemokratische Partei Deutschlands:

partei.altname={
     ...
     ["Piratenpartei Berlin"]="Piratenpartei Deutschland",
     ...
     }

Acronyms or short names[Quelltext bearbeiten]

See Module:Partei/Akronyme

partei.info={
     ...
     ["AT-ÖVP"]={"Österreichische Volkspartei"},
     ["DE-PIRATEN"]={"Piratenpartei Deutschland"},
     ...
     }

The first value is used, at the same time:

  • as "selector" to determine the party color in Modul:Partei/Liste;
  • as link target inside the wikilink [[partei|akronym]]

→ Support to Vorlage:Parlamentswahl.
Inside the wikilink [[partei|akronym]]:

  • the element partei (link target) is connected with the value nationality-acronym;
  • the element acronym (link label) is part of that local value.

Exceptions

A. When an acronym includes a disambiguation, it cannot be used as link label. A disambiguation is necessary when the informations nationality-acronym are not sufficient to identify a party in an unequivocal way. In this case, a second value must be written:

partei.akronym={
     ...
     ["DE-DSP-1"]={"Deutschsozialistische Partei", "[[Deutschsozialistische Partei|DSP]]"},
     ["DE-DSP-2"]={"Deutschsoziale Partei", "[[Deutschsoziale Partei|DSP]]"},
     ...
     ["DE-FW"]={"Bundesverband der Freien Wähler"},
     ["DE-FW(BV)"]={"Freie Wähler (Partei)", "[[Freie Wähler (Partei)|FW]]"},
     ...
     }

The first value (Freie Wähler (Partei)) is used only to return the color of the party; the second value ([[Freie Wähler (Partei)|FW]]) is used as party's name inside the template Parlamentswahl.

B. The second value can be also a sequence of parties with wikilinks:

partei.akronym={
     ...
     ["BE-PSC/CVP"]={"Centre Démocrate Humaniste", "[[Centre Démocrate Humaniste|PSC]]/<br/>[[Christen-Democratisch en Vlaams|CVP]]"},
     ...
     }

The string [[Centre Démocrate Humaniste|PSC]]/<br/>[[Christen-Democratisch en Vlaams|CVP]] is used as party's name inside the template Parlamentswahl.

In any case, the first value must not include any wikilinks.

In the cases A. and B., there are two values stored for each party, respectively:

  1. required value – the party's name;
  2. required value – a wikilink including the party's name and the acronym (or a sequence of wikilinks).

In the other cases, the party's name is the only value.

Functions for lua[Quelltext bearbeiten]

The functions as documented above can be used by other modules per require().

  • farbe
Standard party color
local farbe = require('Modul:Partei').farbe
This function returns the standard or the alternative color which has been assigned to a party. If the requested party does not exist, the function returns DABAD0.
  • alt
Alternative party color
local alt = require('Modul:Partei').alt
This function returns the standard or the alternative color which has been assigned to a party. If the requested party does not exist, the function returns DABAD0.
  • hell
Party light color
local hell = require('Modul:Partei').hell
This function returns the standard or the alternative light color which has been assigned to a party, or a light color based on a specific HEX color code. If the requested party does not exist, the function returns F8F2F6.
This function always starts with a HEX color code: this color is the party's color code that the function farbe passed to it (i.e. the standard color or the alternative color), or a local color code.
  • parteinamefarbe
Cell with color + Party's name
local parteinamefarbe = require('Modul:Partei').parteinamefarbe
This function uses the color that the function farbe passed to it, i.e. the standard color or – through the parameter/value V = A – the alternative color.
  • parteifarbezeile
Cell with colored bottom border + Party's name
local parteifarbezeile = require('Modul:Partei').parteifarbezeile
This function uses the color that the function farbe passed to it, i.e. the standard color or – through the parameter/value V = A – the alternative color.
  • parteifarbezelle
Cell with color
local parteifarbezelle = require('Modul:Partei').parteifarbezelle
This function uses the color that:
  • the function farbe passed to it, i.e. the standard color or – through the parameter/value V = A – the alternative color, or otherwise
  • the light color that the function hell passed to it, i.e. the light standard color – through the parameter/value V = H – or the light alternative color – through the parameter/value V = HA.
  • pipelink
Party full name
local pipelink = require('Modul:Partei').pipelink
This function returns the party full name which has been assigned to a string including a couple of values (a, b) which identifie a party representing nationality and acronym respectively. If the string nationality-acronym does not exist, the function returns the same acronym (provided that the nationality has been indicated with two characters, otherwise the acronym is not correctly indicated). The party full name is included in a wikilink: the link target is constitued by the party name, while the link label by the same acronym which has been used to identify the party or, if this acronym includes a disambiguation, by an other acronym. The function can return a sequence of parties too.