Template talk:Party name with color

Multiple rows
Can this template span multiple rows in a table? Might be good to have some documentation.  Schwede 66  08:16, 21 November 2013 (UTC)


 * @Schwede66 @MPGuy2824 Yes, after a small change introducing a named optional  parameter,   like Special:Diff/1044238516/1044249967. If this seems appropriate, I can go ahead and update it, and the usage becomes   Your thoughts? — DaxServer (talk to me) 09:05, 14 September 2021 (UTC)
 * Works, for my limited tests. Thanks. -MPGuy2824 (talk) 09:38, 14 September 2021 (UTC)
 * ✅ Also updated Full party name with color — DaxServer (talk to me) 09:43, 15 September 2021 (UTC)

Documentation
This template is being used in multiple places, but has no documentation, and no obvious means to edit it. How does it work? How are errors fixed? Why are some parties names listed in full, and others not? I can see the "full" parameter listed, but without an example this is of no use. Greenman (talk) 22:22, 3 May 2019 (UTC)
 * It's still not clear to me how this template works. Why are some of the entries in City of Cape Town elections full names, and not others. How to fix? Greenman (talk) 22:27, 29 September 2021 (UTC)
 * It is based on their shortname template. See Template:Democratic Alliance (South Africa)/meta/shortname vs Template:African National Congress/meta/shortname -MPGuy2824 (talk) 03:15, 30 September 2021 (UTC)

Piped links
can you add a  somewhere so that this supports piped links when used with. For instance,  would become. – Finnusertop (talk ⋅ contribs) 00:35, 2 February 2020 (UTC)

Deprecate/remove rows and colour spelling variants
Could we do that as rowspan seems more natural in a table and color is in sync with the spelling in the template itself? (The transclusions have to be updated first, perhaps with AWB, along with the .) — DaxServer (talk) 10:15, 11 January 2022 (UTC)


 * I don't oppose this. I just merged the two templates. Gonnym (talk) 10:23, 11 January 2022 (UTC)

Undisambiguated full name
Some parties need undisambiguated full names, like Communist Party of India (Marxist)

How do we approach them? — DaxServer (talk) 10:12, 12 January 2022 (UTC)


 * Do you have a real-world example of when this template is used, but the what's needed is the full name with the disambiguation? Gonnym (talk) 10:24, 12 January 2022 (UTC)
 * Here Ambasamudram (state assembly constituency)#Tamil Nadu the Communist Party of India link should also display (Marxist), as in this case it is not a WP disambiguation but a real-world party name, unlike the Labour Party WP disambiguations. (I expanded the table) Yes, we need the full name with the disambiguation. — DaxServer (talk) 10:41, 12 January 2022 (UTC)
 * Then we can add a parameter like dab (or if you have a better word) which when set gives the complete name including the dab (basically the text as is). Gonnym (talk) 10:48, 12 January 2022 (UTC)
 * I made the changes in sandbox and put a test case. I'm wondering if there are parties with multiple disambiguators in the title, and should we just add a new param to display what's provided in it, like the color and shortname override? — DaxServer (talk) 17:20, 15 January 2022 (UTC)
 * You don't need both dab and full. They should be mutually exclusive. Gonnym (talk) 17:29, 15 January 2022 (UTC)
 * I started a LUA version in the sandbox, but I wasn't sure how to implement the |dab=y logic. Frietjes (talk) 19:08, 25 January 2022 (UTC)
 * Nice, I'm going over the code now. Can you explain what the  and   are? single character names are not a great design-wise idea as they make it very hard for other people to understand the code. Gonnym (talk) 19:27, 25 January 2022 (UTC)
 * Ok, figured it out and tweaked the logic to handle the dab like in the previous template sandbox. This should be working I think. Gonnym (talk) 19:59, 25 January 2022 (UTC)
 * adding "rowspan=1" is redundant and no stray semi-colon needed. Frietjes (talk) 21:33, 25 January 2022 (UTC)
 * even better would be to have a way to fetch both the color and the shortname at the same time. Frietjes (talk) 21:46, 25 January 2022 (UTC)
 * I agree that it's redundant but it's still better than having 5 additional lines of code just to verify the value is more than 1 (in this case cleaner code outweighs a redundant rowspan value). Regarding fetching both at the same time, I think Primefac set the module with loadData so that additional calls from the same page don't cost more. That said, geting both at the same time is indeed better overall but that requires changes in that module as well. Gonnym (talk) 22:25, 25 January 2022 (UTC)
 * I also agree with clean code over redundancy in this case. — DaxServer (talk · contribs) 08:46, 26 January 2022 (UTC)
 * Nice work! Given the problem the problem that the module is addressing (pages with many uses), emitting a redundant rowspan is counter productive in my opinion. Thanks! Plastikspork ―Œ (talk) 14:12, 26 January 2022 (UTC)
 * Though rowspan="1" isn't actually an issue. That's a valid value, it is just redundant. However, less clear code an issue. Gonnym (talk) 14:33, 26 January 2022 (UTC)
 * Normally I would agree, but I disagree for a module that may be used hundreds of times on the same page. And, I don't think the code is any less clear. Thanks! Plastikspork ―Œ (talk)  15:34, 26 January 2022 (UTC)
 * I can't see how you think that.
 * The second version makes (a) the first variable clear from a glance what it's for, while in the first version there is no way without reading additional lines. And (b) the rowspan is clear that it is either a number or 1, while in the first example it does additional things. Gonnym (talk) 16:15, 26 January 2022 (UTC)
 * Unless there's a strong reason as to why rowspan=1 redundancy is discouraged over clear understanding of the code, I'd say we just use super simple option 2 above. If the additional bytes added by it is the reason, that argument doesn't belong here, instead robust changes as to how Wikimedia as a whole would reduce the size is the solution that you're looking for. — DaxServer (talk · contribs) 17:02, 26 January 2022 (UTC)
 * The reason is in the thread directly below. 1891 unnecessary   in a single article with no significant penalty for not including the pointless rowspan=1.  Thanks! Plastikspork ―Œ (talk)  14:14, 27 January 2022 (UTC)
 * I created a [//en.wikipedia.org/w/index.php?title=Module:Party_name_with_color&oldid=1068290213 new version] which hopefully satisfies everyone. Frietjes (talk) 16:42, 27 January 2022 (UTC)
 * The reason is in the thread directly below. 1891 unnecessary   in a single article with no significant penalty for not including the pointless rowspan=1.  Thanks! Plastikspork ―Œ (talk)  14:14, 27 January 2022 (UTC)
 * I created a [//en.wikipedia.org/w/index.php?title=Module:Party_name_with_color&oldid=1068290213 new version] which hopefully satisfies everyone. Frietjes (talk) 16:42, 27 January 2022 (UTC)

I'm convinced with Plastikspork. We could update sandbox and switch to the module if there are no objections? — DaxServer (t · c) 14:15, 9 February 2022 (UTC)
 * done. Frietjes (talk) 16:21, 9 February 2022 (UTC)
 * @Frietjes Shouldn't the  check come before   check (line 26) so the dab overrides the full? The table at the top of this section is still disambiguated. Also see Template:Full party name with color/testcases — DaxServer (t · c) 13:04, 10 February 2022 (UTC)
 * Template:Party name with color/testcases seems to pass. If there is a situation not covered there, add it so it will be easier to understand what issue you are referring to. Gonnym (talk) 13:27, 10 February 2022 (UTC)
 * test added for dab and full. Frietjes (talk) 16:39, 10 February 2022 (UTC)
 * So as I thought, using dab and full together is a failure in understanding what each does. They don't work together, an editor chooses which one they want. This edit was pointless in that regard. Gonnym (talk) 20:30, 11 February 2022 (UTC)
 * It looks like the problem comes from using Full party name with color with dab. In that case, you shouldn't be using Full party name with color since the "full" is pointless.  All three of these toggles should be consolidated into one parameter. Plastikspork ―Œ (talk)  14:44, 12 February 2022 (UTC)

Category:Pages with script errors
Gonnym, I have temporarily removed the tracking module to remove List of elected British politicians who have changed party affiliation from Category:Pages with script errors. Another approach could be to merge this to a subfunction of Module:Political party and include the tracking there. That would reduce the number of module calls from 3 to 1, and would probably fix the problem as well. Thanks! Plastikspork ―Œ (talk) 14:21, 24 January 2022 (UTC)


 * Wow. That article. No words. Gonnym (talk) 14:28, 24 January 2022 (UTC)
 * Same here. This is the first time I'm looking at a table "spanning multiple sections" — DaxServer (talk · contribs) 14:31, 24 January 2022 (UTC)

New implementation
How about:


 * 1) Using Party abbr with color (or abbrev, see Template:Party abbrev, or redirect one to the other?) to show abbreviation
 * 2) Using Party shortname with color to show shortname from the political party module (not sure if this is useful)
 * 3) Using Party name with color to show the fullname of the party, with dab toggle to show with dab
 * 4) Dropping Full party name with color in favor of #3
 * 5) Create missing no link templates (if not useful, then only update Party name with color no link to appropriate one depending on the usages)
 * 6) Use same params across all: label or text to override the text that is displayed; and color override.
 * 7) In module, create functions abbr, shortname and fullname functions that serve each template above, with tracking categories. This separation of functions would remove the complex if-else blocks, if any. Each of them know what they need to do.

This could be a bit disruptive as they are used heavily: Pnwc in 3700+ articles, Fpnwc in 1100+, Pnwc no link in ~53  articles. Personally I don't like the color override as they are centralized in the political party module. The Pnwc template is anyway already misleading as it shows abbr by default and not "name". We could run AWB in batches to update one after the other so that nothing breaks, if we implement some changes, that is. And finally, update Wikidata interwiki links for these templates. Thoughts? — DaxServer (t · c) 10:36, 15 February 2022 (UTC)


 * A need should come before creation. There is a reason two of the templates above are red, they are not needed (and just to be clear, I'm opposed to their creation and will send them to TfD). There is also no reason to change this template to return the full name. A full name is what an editor passes to the template so why would it return it? If you mean the full name as it is used now (without the dab), then we already have a template that does that and if we want something more systematic then it should be handled by the module. Really almost none of the above maybe except for 6 is helpful. Gonnym (talk) 12:45, 15 February 2022 (UTC)

Sort by visible text instead of by name parameter?
and I have raised two separate issues with this template at. Some Labour MPs are "Labour Co-operative" and others are "Welsh Labour", with all appearing as "Labour" in List of MPs for constituencies in Wales (2019–present) – this is fine. But because sorting is by the name parameter rather than the visible text, "Labour" MPs appear in two different places when they're sorted alphabetically. Similarly, because "Conservative" MPs are entered as "Welsh Conservatives", they also appear out of alphabetical order when sorted. Sorting should be according to what the reader of the page can see. Ham II (talk) 15:00, 2 May 2022 (UTC)

Automatically including undisambiguated full name for some parties
Above there is the discussion of implementing the  parameter. It would be better if, for parties like Communist Party of India (Marxist), there is an internal parameter similar to dab which is specified in the political party module and will automatically give the undisambiguated name in the template {{Party name with color or {{Full party name with color. I know @Gonnym you were involved with the last change, would it be possible to make a such a change to the module? Any such automatic undisambiguation should be allowed to be overwritten by. C1MM (talk) 13:02, 28 June 2024 (UTC)


 * I don't understand what you are asking for. This template has various return options, standard, full without disambiguation, short name, full name with disambiguation, abbreviation. There is no way this template can know automatically what you want to do with a party name in a specific article, and what {{em|you}} want, might not be what others want. Gonnym (talk) 18:21, 1 July 2024 (UTC)