Jump to content

Module talk:Political party/uses

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Gonnym (talk | contribs) at 10:28, 29 October 2021. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

This lists current uses of /shortname, /color, and /abbrev templates.

Infoboxes and templates

Template shortname color abbrev Via Current code New code Notes
{{Infobox election}} Yes via {{Infobox election/shortname}} {{#switch:{{{name|}}} |Other|other|={{{name|}}} |#default= {{#ifeq:{{{link}}}|no |{{{name}}} |{{#ifexist:Template:{{{name}}}/meta/shortname |[[{{{name}}}|{{Template: {{{name}}}/meta/shortname}}]] |{{{name}}} }} }} }} {{#invoke:Political party|fetch|{{{name|}}}|shortname}} Return the name given if no value
Yes {{Infobox election/row}} {{#if: {{{color1|}}} | border-bottom: 6px solid #{{{color1}}} | {{#ifeq: {{{party_color}}} | no | | {{#if: {{{party1|}}} | {{#ifexist:Template:{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party1}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}/meta/color | border-bottom: 6px solid {{Template:{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party1}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}/meta/color}} }} }} }} }}" {{#if: {{{color1|}}} | border-bottom: 6px solid #{{{color1}}} | {{#ifeq: {{{party_color}}} | no | | {{#if: {{{party1|}}} | {{#if: {{#invoke:Political party|fetch|{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party1}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}|color}} | border-bottom: 6px solid {{#invoke:Political party|fetch|{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party1}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}|color}}; }} }} }} }}" No default value used.
{{Infobox legislative election}} Yes {{Infobox election/shortname}} See above See above
Yes via {{Infobox legislative election/row}} {{#if: {{{colour|}}} | border-left: 4px solid {{{colour}}}; | {{#ifexist:Template:{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}/meta/color | border-left: 4px solid {{ {{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}/meta/color}}; }} }} {{#if: {{{colour|}}} | border-left: 4px solid {{{colour}}}; | {{#if {{#invoke:Political party|fetch|{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}|color}} | border-left: 4px solid {{#invoke:Political party|fetch{{#invoke:delink|delink|wikilinks=target|1={{#invoke:string|replace|source={{{party}}}|pattern=^(%[%[%s*[^%]%[]*%]%]).*$|replace=%1|plain=false}}}}|color}}; }} }} No default value used.
{{Compact election box}} Yes
  • [[{{{winner_party|}}}|{{Template:{{{winner_party|}}}/meta/shortname}}]]
  • [[{{{loser_party|}}}|{{Template:{{{loser_party|}}}/meta/shortname}}]]
  • [[{{{winner_party|}}}|{{#invoke:Political party|fetch|{{{winner_party|}}}|shortname}}]]
  • [[{{{loser_party|}}}|{{#invoke:Political party|fetch|{{{loser_party|}}}|shortname}}]]
Yes style="background-color: {{Template:{{{winner_party|}}}/meta/color}}" style="background-color: {{#invoke:Political party|fetch|{{{winner_party|}}}|color}}" This produces (in both old and new) a blank background-color attribute if nothing is found.
Yes [[{{{swing_from|}}}|{{#ifexist: Template:{{{swing_from|}}}/meta/abbrev | {{Template:{{{swing_from|}}}/meta/abbrev}} | {{Template:{{{swing_from|}}}/meta/shortname}} }}]] to [[{{{swing_to|}}}|{{#ifexist: Template:{{{swing_to|}}}/meta/abbrev | {{Template:{{{swing_to|}}}/meta/abbrev}} | {{Template:{{{swing_to|}}}/meta/shortname}} }}]] [[{{{swing_from|}}}|{{#invoke:Political party|fetch|{{{swing_from|}}}|abbrev}}]] Uses fallback: abbr->shortname without full name. Current (/meta) code breaks as it has no fallback to input (full name).
{{Compact election box no change}} Same as above
{{Election box candidate for alliance}} Yes [[{{{party}}}|{{Template:{{{party}}}/meta/shortname}}]] ([[{{{side}}}|{{Template:{{{side}}}/meta/shortname}}]] [[{{{party}}}|{{#invoke:Political party|fetch|{{{party}}}|shortname}}]] ([[{{{side}}}|{{#invoke:Political party|fetch|{{{side}}}|shortname}}]] New code provides name fallback.
Yes style="background-color: {{Template:{{{party}}}/meta/color}}" style="background-color: {{#invoke:Political party|fetch|{{{party}}}|color}}" No fallback for color.
{{Election box candidate no party link no change}} Yes {{Template:{{{party}}}/meta/shortname}} {{#invoke:Political party|fetch|{{{party}}}|shortname}} New code provides name fallback.
Yes style="background-color: {{Template:{{{party}}}/meta/color}};" style="background-color: {{#invoke:Political party|fetch|{{{party}}}|color}}; No fallback for color.
{{Election box candidate with party link}} Yes Yes Similar to above.
{{Election box gain}} Yes {{#ifexist:Template:{{{winner}}}/meta/shortname|{{{{{winner}}}/meta/shortname}}|{{{winner}}}}} '''gain''' from {{#ifexist:Template:{{{loser}}}/meta/shortname|{{{{{loser}}}/meta/shortname}}|{{{loser}}}}} {{#invoke:Political party|fetch|{{{winner}}}|shortname}} '''gain''' from {{#invoke:Political party|fetch|{{{loser}}}|shortname}} Fallback makes code shorter.
Yes {{#ifexist:Template:{{{winner}}}/meta/color|background-color: {{{{{winner}}}/meta/color}}}} {{#if: {{#invoke:Political party|fetch|{{{winner}}}|color}} | background-color: {{#invoke:Political party|fetch|{{{winner}}}|color}} }} Could maybe provide a default value to reduce the second call.
{{Election box gain no swing}} Yes Yes Same as above.
{{Election box gain with party link}} Yes Yes Similar to above.
{{Election box gain with party link no swing}} Yes Yes Similar to above. New code provides fall back. Exact same code as below - templates should be "merged" to a renamed template.
{{Election box gain with party link no change}} Yes Yes Exact same code as above - templates should be "merged" to a renamed template.
{{Election box gain with party link without swing}} Yes Yes Exact same code as above - templates should be "merged" to a renamed template.
{{Election box gain with party link and percentage}} Yes Yes
{{Election box gain with party link and swing no change}} Yes Yes
{{Election box hold with party link}} Yes Yes
{{Election box hold with party link no change}} Yes Yes
{{Election box hold with party link no swing}} Yes Yes
{{Election box metadata}} Yes Yes Not entirely sure what this is
{{Election box new seat win}} Yes Yes
{{Election box new boundary win}} Yes Yes
{{Election summary party}} Yes Yes
{{Election winner list with party link}} Yes Yes
{{Elected official with party link}} Yes Yes
{{Political party list}} Yes Yes
{{UKPP}} Yes Yes
{{Officeholder table}} Yes Yes Yes
{{Officeholder table coalition}} Yes
{{Officeholder table cabinet}} Yes Yes

and lots more in Category:Election and referendum infobox templates.

Modules

Infobox/template shortname color abbrev Notes
Module:Election results Yes

Other uses

color

Possible uses

Templates where it could be added

Infobox/template Suggested addition Notes
{{Infobox political party}} color Currently colorcode has to be entered manually. Could automatically look up a colorcode that matches the article title and override that with a manually entered one.

Documentation templates that would probably be deleted

Non-template /meta/abbr uses