Template talk:Enum
Add topicSandboxed version is better
[edit]The sandboxed version works with the comma= parameter properly; the version in main doesn't. (See the testcases.) Can we move it over? I've written the same at Module talk:Separated entries, as I don't know who's watching which (if anyone). Si Trew (talk) 09:30, 14 November 2015 (UTC)
Optional serial comma
[edit]@Zackmann08: Here you propose to modify {{Enum}} to support serial commas (optionally). That can be done easily, however the reason I still prefer a separate template is that I cannot figure out a truly convenient syntax for {{Enum}}. How should it look like?
{{Enum|A|B|C|serial=yes}}?{{Enum|A|B|C|serial=, and{{space}}}}?{{Enum|A|B|C|serial=,}}?
Solution #1 has the problem that it might behave awkwardly together with the current |and= parameter: how should the template behave when someone writes {{Enum|A|B|C|and=///|serial=yes}}? That could be alleviated however by the fact that the template has a |comma= parameter too. Solution #2 is verbose. It will be faster to write A, B, and C by hand. Solution three is similar to solution #1—we must assume that if someone is crazy enough to write {{Enum|A|B|C|and=///|serial=yes}}, the template will output A, B,///C. What do you think? You can also propose something radically different. --Grufo (talk) 15:45, 12 December 2025 (UTC)
- Update. The current version of Template:Enum/sandbox (as of writing) is a possible implementation of solution #1:
{{Enum/sandbox|A|B|C}}- ↳ A, B and C
{{Enum/sandbox|A|B|C|serial=yes}}- ↳ A, B, and C
{{Enum/sandbox|A|B|serial=yes}}- ↳ A and B
{{Enum/sandbox|||A|||||B||||serial=yes}}- ↳ A and B
{{Enum/sandbox|A|B|C|and=?|serial=yes}}- ↳ A, B,?C
{{Enum/sandbox|A|B|C|and=?}}- ↳ A, B?C
{{Enum/sandbox|A|B|C|comma=!|and=?|serial=yes}}- ↳ A!B!?C
- On a side note, it also fixes a bug no one might have noticed so far, i.e. the fact that
|after=is currently ignored when the first parameter is empty. Compare the following outputs (as of writing):{{Enum|A|B|C|after=///}}- ↳ A, B and C///
{{Enum||A|B|C|after=///}}- ↳ A, B and C
{{Enum/sandbox||A|B|C|after=///}}- ↳ A, B and C///
- P.S. This discussion follows this other discussion. --Grufo (talk) 16:29, 12 December 2025 (UTC)
- @Sdkb: You were interested in this feature. Pinging you too. --Grufo (talk) 16:50, 12 December 2025 (UTC)
- I oppose using Params. The template worked perfectly without it. Get your code to work with existing systems. Gonnym (talk) 19:31, 15 December 2025 (UTC)
“I oppose using Params”
: On what ground?“Get your code to work with existing systems”
: If I am not wrong Module:Params has been an existing system since 2023. But you can implement the solution above using a different backend if you think it is better. Comparing different possibilities can be very helpful. --Grufo (talk) 22:35, 15 December 2025 (UTC)- I don't have to explain everything to you each time. This template worked without your module. Gonnym (talk) 07:56, 16 December 2025 (UTC)
- I have difficulties understanding what you are arguing against. Of course the current template works—although see the bug above. Now we are trying to implement a new feature. I would be very happy if you found any alternative solution that pleases you, written however you like. --Grufo (talk) 13:31, 16 December 2025 (UTC)
- This template uses Module:Separated entries. You can add the serial feature in one of two ways. Either implement it locally here by adding
|conjunction={{#if: {{{serial|}} |, and{{space}} }}or by adding a|serial=option to Module:Separated entries. If this feature is wanted in other places, it should be added to the module. If this is only needed here, then to the template. In either way, there is no reason to replace the base module with params. Gonnym (talk) 16:08, 16 December 2025 (UTC)“This template uses Module:Separated entries”
: So far yes; do we have particular reasons to stick to that module or are we bound to it by a declaration of faith?“implement it locally”
: The example you propose is not a serial comma for the reasons explained a thousand times. It will make it a nightmare to use serial commas in automatically-generated lists like{{Enum|{{{one|}}}|{{{two|}}}|{{{three|}}}|serial=yes}}(when one of the three parameters is empty you get a serial comma with two items).“or by adding a
: Would you really prefer to bloat Module:Separated entries with a feature requested only by a particular template, especially when it is already supported natively and smoothly by Params (which also uses a better syntax that does not require HTML entities—particularly annoying in template substitution)? And what about the bug mentioned above? --Grufo (talk) 17:06, 16 December 2025 (UTC)|serial=option to Module:Separated entries”- I would prefer literally anything other than the abomination that is the current code at Template:Enum/sandbox. I'm sorry, if you think that reading a code with ~13 unnamed parameters, one of which is the completely meaningless
i/l/s/f, is easier than the code at Template:Enum, then we aren't speaking the same language. Gonnym (talk) 17:25, 16 December 2025 (UTC)- Right, so it is about code readability. Yet Module:Params is well-documented, its directives are in plain English and in the sandbox example each line is independent from the other lines (each line in the form of
directive|arguments...|). The linesetting|i/l/s/f|...means: set aniteration delimiter (,), alast delimiter (and), aserial-comma-like delimiter (, and) and afooter, in the order provided (as explained in the documentation). This syntax has the great advantage that it does not require gratuitous HTML entities (which are often annoying in template substitutions). Is there any other line in the code of Template:Enum/sandbox that looks obscure? One single line seems a bit too few for for such a fuss. --Grufo (talk) 17:55, 16 December 2025 (UTC)- Do you not understand what "no" means? There is absolutely nothing you can say which will make me support your module. You are forcing that module slowly on more pages without getting any consensus to do so. You have not shown that the current modules fail. You have not tried fixing those modules. You are just creating new templates and modules and quietly trying to create a parallel system. I've shown you how this can be achieved here or at the parent module. I will not respond to you anymore here. I'll also note that I've seen your canvasing in this and other places. Gonnym (talk) 10:56, 17 December 2025 (UTC)
“You are forcing that module slowly on more pages without getting any consensus”
: I wonder if you are able to listen to what you say. I literally created a separate template to avoid touching {{Enum}} (I still think a dedicated template is the optimal solution btw). When I think that Module:Separated entries has no drawbacks compared to Module:Params I am the one that pushes for the former—even though sometimes slower or less efficient—because I do not want too many transclusions for Module:Params that might tie the module's development. But the most absurd thing is that when I do not use my code enough you regularly nominate for deletion my templates as “unused”: now you can't complain that I use what I create.“You have not shown that the current modules fail”
: I have literally shown a bug, which you keep avoiding (see above). But the main reason we are here is not that bug (which needs to be solved btw, it is less abstract than it looks), but implementing a new functionality (after being invited to do so here).“Do you not understand what ‘no’ means?”
: I usually understand what “no” means and we have registered your “no”. You are truly free to go now. --Grufo (talk) 13:59, 17 December 2025 (UTC)- I largely agree with @Gonnym. Module:Params introduces a new complex programming language and should not be used anymore. See Module talk:Params#Not a sustainable approach to templates and Wikipedia:Village pump (technical)#Module:Params. — Chrisahn (talk) 09:05, 9 June 2026 (UTC)
- Do you not understand what "no" means? There is absolutely nothing you can say which will make me support your module. You are forcing that module slowly on more pages without getting any consensus to do so. You have not shown that the current modules fail. You have not tried fixing those modules. You are just creating new templates and modules and quietly trying to create a parallel system. I've shown you how this can be achieved here or at the parent module. I will not respond to you anymore here. I'll also note that I've seen your canvasing in this and other places. Gonnym (talk) 10:56, 17 December 2025 (UTC)
- Right, so it is about code readability. Yet Module:Params is well-documented, its directives are in plain English and in the sandbox example each line is independent from the other lines (each line in the form of
- I would prefer literally anything other than the abomination that is the current code at Template:Enum/sandbox. I'm sorry, if you think that reading a code with ~13 unnamed parameters, one of which is the completely meaningless
- I have difficulties understanding what you are arguing against. Of course the current template works—although see the bug above. Now we are trying to implement a new feature. I would be very happy if you found any alternative solution that pleases you, written however you like. --Grufo (talk) 13:31, 16 December 2025 (UTC)
- I don't have to explain everything to you each time. This template worked without your module. Gonnym (talk) 07:56, 16 December 2025 (UTC)
- I oppose using Params. The template worked perfectly without it. Get your code to work with existing systems. Gonnym (talk) 19:31, 15 December 2025 (UTC)
- @Sdkb: You were interested in this feature. Pinging you too. --Grufo (talk) 16:50, 12 December 2025 (UTC)
@Sdkb: There might not not be enough openness and pragmatism over here. What do you propose for a template that is able to display a serial comma? How would you envision it? A new template? An existing template? This template (see the sandbox above)? Anything else? --Grufo (talk) 22:30, 15 December 2025 (UTC)
A new template
you do remember the template was deleted before, right? Gonnym (talk) 07:58, 16 December 2025 (UTC)- Which is why we are here, no? Or else, I don't understand what you would like us to do. --Grufo (talk) 13:33, 16 December 2025 (UTC)