Template talk:Election results
Add topic
| This template does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||
| |||||||||||||||
Embedding
[edit]I'm currently drafting a big revamp of 2002 Dutch general election. You can see my current progress here.
One thing I've noticed is that, while template:election results is more compact and sortable than a wikitable, it is inferior when it's used to supplant prose sections because it does not allow text to embed besides it. You can see this in my draft when comapring the section "Incumbent coalition wins re-election (1998)" to "Municipal elections and debate (6 March 2002)". I would appreciate if someone with more technical know-how than me would add embed parameters to this template. Koopinator (talk) 12:16, 23 April 2025 (UTC)
- Done. Just add floatright=yes to the code. I have updated the version in your sandbox to demonstrate. Number 57 22:36, 24 April 2025 (UTC)
Template for +/− seats
[edit]Is there any reason why the format for addition or subtraction uses an en dash (–) rather than a minus sign (−) in the template? Wikipedia discourages using anything other than a minus sign (see MOS:FORMULA), so is this an intentional exception, or a mistake that needs to be rectified? MrSwedishMeatballs (talk) 19:00, 28 April 2025 (UTC)
- Upon further inspection, this seems to be a problem with Module:Election results itself. Lua should support Unicode 1.1 characters, so it just needs someone high enough up to change it. MrSwedishMeatballs (talk) 19:14, 28 April 2025 (UTC)
- Apologies, could you give me the line number that needs changing? Primefac (talk) 14:24, 17 May 2025 (UTC)
Fourth round
[edit]Hello! I have an election with a fourth round, which the template does not support. I totally understand if we don't want to make this table more complicated for specific cases, but on the other hand it would be very helpful for me. How do people feel about this? Dajasj (talk) 08:58, 27 September 2025 (UTC)
- The problem is the amount of code that would be needed to add a fourth round, which I'm not sure is justified based on how few articles might need it? Unless someonw can completely rework the code so it automatically repeats rounds instead of them having to be coded separately. You could use {{Election results-STV}}, but it doesn't display invalid votes after round one. Number 57 00:19, 28 September 2025 (UTC)
- That's a fair point. I'm not an expert on these templates. But sounds like it is best to create a non-template version for this page, unless more people require a fourth round in the future. Dajasj (talk) 10:30, 28 September 2025 (UTC)
More cleanup needed for dark mode
[edit]For minimal dark mode compatibility, syntax requires that color: be set in every style= declaration where background: or background-color: is set. Currently, there are many places in the module where background: is set without a corresponding color. I tried to address this in the sandbox by adding color:inherit in most places where a color declaration is lacking. I have run into one small problem in dark mode: when the background color is too light, the inherited white text placed on that background is not readable. See the "Unaffiliated" row in this test case (in dark mode): white on white.
I think that making use of the calculations of {{Greater color contrast ratio}} should resolve this problem, but I don't know how to do it in Lua. Basically, I think that what is needed is to feed the background color variable value into the equivalent of {{Greater color contrast ratio}} and have it generate and store the resulting color (white or black by default) in a color variable. That color could then be supplied to each cell rendered by the Election results module.
Does anyone know how to program this, if it seems like a valid idea? – Jonesey95 (talk) 21:46, 5 October 2025 (UTC)
- Hello. Sorry, I can't help you with what you're looking for. Just, I noticed the background color of the election diagrams which we add via the "image=" line has switched to the darker grey of the headers, instead of the lighter grey as usual. Which is not so good, because all contrast added change the way the colors look, and the very point of the diagrams is to show the results via the colors. Some countries have parties with close color shades so color accuracy is needed. Whenever you find what you're looking for, could you please make sure to switch back the background color of the image top cell to the background color of the table inner cells, not the darker header cells? Cordially. --Aréat (talk) 17:50, 17 December 2025 (UTC)
- Hmmm, I think that may be a skin issue. I'm using Monobook and see the parliamentary diagrams in the light table cell shade rather than the header cells. Number 57 19:29, 17 December 2025 (UTC)
- I do see them normally on mobile while it's dark grey on PC, but both were normal before. Something seem to have changed. --Aréat (talk) 16:28, 20 December 2025 (UTC)
- Might be something to do with css stuff, but that's way beyond my technical capability I'm afraid... Number 57 17:29, 21 December 2025 (UTC)
- I believe that I have addressed this issue. I have checked all of the test cases on the testcases page. Frietjes, if you decide to make your changes live, please include the CSS color declarations that I have put in the sandbox. – Jonesey95 (talk) 23:20, 2 April 2026 (UTC)
- Might be something to do with css stuff, but that's way beyond my technical capability I'm afraid... Number 57 17:29, 21 December 2025 (UTC)
- I do see them normally on mobile while it's dark grey on PC, but both were normal before. Something seem to have changed. --Aréat (talk) 16:28, 20 December 2025 (UTC)
- Hmmm, I think that may be a skin issue. I'm using Monobook and see the parliamentary diagrams in the light table cell shade rather than the header cells. Number 57 19:29, 17 December 2025 (UTC)
s2span parameter
[edit]I recently updated 1990 Croatian parliamentary election to add standard results table templates (with vote numbers, separately for each house) instead of the nonstandard table (only with percentages, all three houses together) that existed until now. However, the source (which was the same for both tables) groups several minor parties and joint candidatures with obtained seats in a single "others" column in both the vote numbers and the seat numbers in each round individually, and they are only separated in the combined seat numbers for both rounds. The template supports colspan for the first round votes (vspan), the second round votes (v2span), and the first round seats (sspan), but not the second round seats. Glide08 (talk) 19:43, 19 December 2025 (UTC)
- Is this what you intended? Number 57 15:35, 20 December 2025 (UTC)
- Yes it is. Thank you. Glide08 (talk) 15:38, 20 December 2025 (UTC)
- Now implemented. Cheers, Number 57 16:11, 20 December 2025 (UTC)
- Thank you. Glide08 (talk) 16:27, 20 December 2025 (UTC)
- Now implemented. Cheers, Number 57 16:11, 20 December 2025 (UTC)
- Yes it is. Thank you. Glide08 (talk) 15:38, 20 December 2025 (UTC)