Anonymous
Not logged in
Talk
Contributions
Create account
Log in
Tales from Chyria
Search
Editing
Template talk:Infobox
(section)
From Tales from Chyria
Namespaces
Template
Discussion
More
More
Page actions
Read
Edit source
New topic
History
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Parameters with space in the name == There might be some valid reasons why two-word parameter names to be spelled with an underscore in the middle, but I would like to propose an easy-to-implement idea of adding a simple input preprocessor to accommodate the users who cannot memorize which template expects an underscore and which expects a space. As this preprocessor is meant to be added in front (without '|list'), without requiring any change in the tried-and-tested template itself, implementation should be simpler than making many changes in different locations: <syntaxhighlight lang=lua> {{#invoke:params|renaming_by_replacing|%s|_|1|list}} </syntaxhighlight> On Chrome browser, the character following '%s|' in the above line appears indistinguishable from a space, but it is an underscore. This symptom might further highlight the benefit of adding this preprocessor. If a space is found in the middle of parameter names, this line replaces it with an underscore (only once on each parameter name, for as many parameters there may be). It leaves single-word parameter names and those parameter names spelled with underscore as is, and it is meant only for those templates that expect an underscore. As a result of adding the line, the template will accept a space where an underscore is expected to join two words in parameter names. What I don't know is where and how best to place it, if it is possible and desirable to place it on Template:Infobox to take care of its child templates at once, or on each child like [[Template:Infobox Treaty]]. And further I don't know if any child template uses parameter names with a space. I would help in editing the doc pages for the change if needed.<br> [[User:Yiba|<span style="color:#B20000;">Yiba</span>]] ([[User talk:Yiba|talk]] | [[Special:Contributions/Yiba|contribs]]) 16:29, 12 February 2025 (UTC) :Feel free to implement this in a sandbox template or module and show how it works. You'll need to account for all sorts of bad choices by template editors. For example: What happens in the degenerate case where there are two distinct parameters, one with a space and one with an underscore but otherwise identical? – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 19:04, 12 February 2025 (UTC) ::Thanks. May be a bit difficult to read, but a demo is at: [[User:Yiba/sandbox/infobox]] ::In this demo, parameters "former_name=Former Name" and "former name=degenerate case" are specified. The first parameter with an underscore is unchanged, and the second parameter is changed by the above line to "former_name=degenerate case" ending up two parameters with the same name. When this occurs, the 'changed' parameter name takes precedence, as it is the spec for "params|renaming by replacing", so the original "former_name=Former Name" is discarded with no harm done.<br><br> ::In an even more foolish case where "|former_name=Former Name|" and "|former name=|" are specified, "former name" is converted into "former_name" and passed without data, with no harm.<br><br> ::In the most degenarate case where "|former name|" is in the line, '1' is prepended as the param name and "1=former name" (without being converted, as neither 'former' nor 'name' is considered as a param name) is passed. As '1' is unknown to Template:Infobox Treaty as a parameter name, it is ignored without harm.<br><br> ::I cannot figure out how to incorporate the line into the template, but as I am not a template editor, I'd need your further help regardless. [[User:Yiba|<span style="color:#B20000;">Yiba</span>]] ([[User talk:Yiba|talk]] | [[Special:Contributions/Yiba|contribs]]) 04:11, 13 February 2025 (UTC) :An easy solution is to just change the templates that use spaces. [[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 11:42, 13 February 2025 (UTC) ::Do you know the reason why this template uses underscore, and not the space? I feel there are much more templates, especially those frequently used for editing, that use space rather than underscore. [[User:Yiba|<span style="color:#B20000;">Yiba</span>]] ([[User talk:Yiba|talk]] | [[Special:Contributions/Yiba|contribs]]) 01:11, 18 February 2025 (UTC) :::[[MOS:INFOBOXNAME]]: {{tq|Use snake case (e.g. {{para|birth_date}}). Not camel case (e.g. {{para|birthDate}}) or title case (e.g. {{para|BirthDate}})}} and {{tq|represent spaces using an underscore, e.g. {{para|birth_place}} not {{para|birth-place}} or {{para|birth place}}}} .[[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 09:42, 18 February 2025 (UTC) ::::There are a few parameter names in {{t|infobox}} itself that should be converted to snake, fwiw. [[User:Primefac|Primefac]] ([[User talk:Primefac|talk]]) 14:58, 18 February 2025 (UTC) ::::Thank you. Now I understand changing Infobox spec may be a daunting task.<br> ::::However: ::::1. "Better for the users" should take priority over "easier to code". ::::2. Manuals are written about something pre-existing. Infobox was coded before the manual was written, and its features were not determined because the manual said so. ::::3. As I have stated, I am willing to rewrite docs, including the MOS if necessary. ::::4. My proposal does not subtract any functionality. ::::5. The proposal does accommodate users better. ::::What do you think? [[User:Yiba|<span style="color:#B20000;">Yiba</span>]] ([[User talk:Yiba|talk]] | [[Special:Contributions/Yiba|contribs]]) 02:46, 20 February 2025 (UTC) :::::I disagree that spaces are better. [[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 09:48, 20 February 2025 (UTC) ::::::I am not saying space is better. I am saying accepting underscore AND space is more user-friendly. This proposal does not reduce convenience for the users who prefers underscore. [[User:Yiba|<span style="color:#B20000;">Yiba</span>]] ([[User talk:Yiba|talk]] | [[Special:Contributions/Yiba|contribs]]) 00:25, 21 February 2025 (UTC) :::::::I'll be blunt and say I don't care what a specific user prefers or does not prefer. We should have one consistent style (whichever it may be) and use that. That isn't something unique to Wikipedia. Every good language has a naming convention. This allows everyone using the system to know what to expect. [[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 10:44, 21 February 2025 (UTC) ::::::::I understand Wikipedia is many different things for different people. But I am sure it was and is NOT meant for the use by programmers (unlike programming tools). The English language uses space (or, sometimes hyphen) in between words, so if we have to standardize and choose between a space and underscore, the choice is clear that it should be the space. ::::::::I am not arguing for standardization, but for the vast majority of English-speaking users and editors of en.wikipedia, a natural expectation would be the system to accept a space connecting two-word names. I don't mind the system expecting an underscore, but allowing the use of space (in addition to underscore) is more user-friendly. [[User:Yiba|<span style="color:#B20000;">Yiba</span>]] ([[User talk:Yiba|talk]] | [[Special:Contributions/Yiba|contribs]]) 05:51, 25 February 2025 (UTC) {{edit template-protected|Module:Infobox/styles.css|demo=yes|answered=yes}} :::::::::I have solicited opinions on the above discussion at [[Wikipedia talk:WikiProject Infoboxes]], and am adding edit request to it now. Please help me implement this change, as I cannot edit the Infobox template, or its components myself.<br> :::::::::[[User:Yiba|<span style="color:#B20000;">Yiba</span>]] ([[User talk:Yiba|talk]] | [[Special:Contributions/Yiba|contribs]]) 05:15, 9 March 2025 (UTC) ::::::::::There is no consensus for this change. The edit request template is for uncontroversial change requests. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 02:40, 10 March 2025 (UTC) :To add another user to the mix, we should not support this. It will make maintenance more difficult for the pretty arbitrary desire to have one or the other kinds of parameters. If you specifically have issues with templates, consider using the templatewizard (in 2010 editor) or the template insertion dialog (in VisualEditor) to do the work for you. (And if those don't work, that's a TemplateData issue that needs to be resolved, which I suspect you are smart enough to fix for arbitrary template.) [[User:Izno|Izno]] ([[User talk:Izno|talk]]) 02:21, 12 March 2025 (UTC) :: {{tq|It will make maintenance more difficult}}: This is just a technical comment (I have no opinions on the “space vs underscore” debate). There are many ways to implement this with {{mfl|params}}. The easiest way is that the current {{tl|Infobox}} template gets moved verbatim to a subtemplate (e.g. {{tl|Infobox/underscores}}) and the content of the new {{tl|Infobox}} becomes the following: :: <syntaxhighlight lang="wikitext">{{#invoke:params|renaming_by_replacing|%s+|_|concat_and_call|Infobox/underscores}}</syntaxhighlight> :: By doing so, the old {{tl|Infobox/underscores}} will keep dealing with underscores as it always did (no spaces there), whereas the user will be able to use both spaces and underscores. This also adds a third possibility to this debate: leaving {{tl|Infobox}} as it is, and creating a wrapper template called {{tl|Spaced infobox}} (or whatever) containing the code above (with <code>Infobox</code> instead of <code>Infobox/underscores</code>). --[[User:Grufo|Grufo]] ([[User talk:Grufo|talk]]) 15:33, 21 April 2025 (UTC)
Summary:
Please note that all contributions to Tales from Chyria may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Chyria Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Wiki tools
Wiki tools
Page tools
Page tools
User page tools
More
What links here
Related changes
Page information
Page logs