User:Chrisahn/Module talk:Params

Deleting this module

This section lists pages that still use Module:Params.

In addition to the ordering by namespace and alphabetic name, we could create sections by how the Params invocations could best be replaced, e.g. by a for-loop like {{For nowiki}}, by parameter-forwarding, or by some other technique. Based on this overview information, we should introduce some new modules (each about 20 to 50 times shorter than Params) to conveniently handle all cases.

Search for "invoke:params" in all namespaces

Here are all relevant current uses I found. Feel free to edit the list. — Chrisahn (talk) 16:19, 2 July 2026 (UTC)

Articles

Templates

Template sandboxes

User pages

Low priority, but there may be some interesting uses of Params that might provide inspiration for new modules. I omitted pages that had "sandbox" or "archive" in their name or path.

Discussion

So, focusing only on "articles" and "templates", we have:

* Pppery * in solidarity 18:17, 2 July 2026 (UTC)

Wrote out a draft for how missing concept 3 would work as Module:Arbitrary named parameters (probably should have a better name), which is 15 lines of code. Not going to deploy it to any templates until Chrisahn or someone else confirms the idea makes sense. * Pppery * in solidarity 18:57, 2 July 2026 (UTC)
I'm not going to pursue missing concept 4 because the only use ended up not being used anywhere itself. * Pppery * in solidarity 18:58, 2 July 2026 (UTC)
Great! Makes perfect sense. A few suggestions:
  • Should we call the module for named parameters, or maybe foreach named parameter? It's a foreach loop, and it's similar to {{For nowiki}} and {{For loop}}.
  • Maybe the code parameter could be unnamed, as in {{For nowiki}}. But that's a matter of taste.
  • I guess there should be a way to exclude certain parameters. For example, {{Internal link with parameters}} has a class parameter that should not be included in the URL. (Although the current code doesn't handle this, and it's a design flaw anyway: What if I want to have a class parameter in the URL, but I don't want to change the CSS class of my table? The template parameter should be renamed to #class or something else that it very unlikely to occur in a URL.)
Chrisahn (talk) 19:32, 2 July 2026 (UTC)
You can exclude named parameters by an if statement based on the name passed to the nowiki-ed code. Although the code as I wrote it did a duplicate separator when you did that, which wasn't ideal, so I fixed that by omitting the separator of the nowiki-ed code returns the empty string. * Pppery * in solidarity 19:37, 2 July 2026 (UTC)
Makes sense. I added another example. If Module:For each named parameter has lots of users one day and many of them want to exclude parameters from processing, we can always add an option to do that without having to write {{#ifeq:{{{name}}}|foo||...}}. But it's fine for now. — Chrisahn (talk) 01:06, 3 July 2026 (UTC)
Regarding paired parameters (or rather, grouped parameters): We could extend Module:For nowiki with a step parameter. In the case of Template:Etymology, which processes parameters in groups of three, we'd set step=3, and the nowiki code block would be executed with three parameters instead of one: First with parameters 1 through 3, then with 4 through 6, etc.
We'd have to come up with a syntax for the additional parameters. Currently, Module:For nowiki only handles {{{i}}} and {{{1}}} in the nowiki code block. The obvious choice is to also handle {{{2}}}, {{{3}}}, etc.
What should {{{i}}} contain? The current index of the first parameter (i.e. 1, 4, 7, ...) or the index of the current group (i.e. 1, 2, 3)?
Also, maybe it would be better to create a new module for this, lest we turn Module:For nowiki into another kitchen sink module. :-)
Chrisahn (talk) 19:00, 2 July 2026 (UTC)
Of course, this step parameter isn't a new idea. Module:For loop has a by parameter. It's similar to the step I suggested, but it's only used in the mode when the module just iterates over numbers, not over parameters. I guess it could be extended to also apply to the parameter mode. (I find step clearer than by, but that's a matter of taste.) There are similar features in Ruby (each_slice), Python (batched), PHP (array_chunk). — Chrisahn (talk) 19:11, 2 July 2026 (UTC)
Wrote up missing concept 1 as Module:Template wrapper positional. * Pppery * in solidarity 19:37, 2 July 2026 (UTC)
Wrote up missing concept 2 as Module:For batched parameters. * Pppery * in solidarity 20:06, 2 July 2026 (UTC)
Re Template:Wrapper I just accepted Primefac's revert - the parameters use was extremely complicated (multiple separate calls with substacks), and in most cases it was ultimately producing info already stated elsewhere in the doc, or tech details that weren't really needed to understand that template at all. So I'm not reimplementing that one at all. It also had more to do with string processing than it did with parameters per se. * Pppery * in solidarity 21:26, 2 July 2026 (UTC)
I agree. Also, I saw the output of that complex Params code in some templates that use {{Template wrapper}}, and I found it hard to understand: Parameters were said to be "managed" or to "work here", but there were "exceptions"... I guess we could have fixed these wording problems, but I don't think it's worth the effort. If a template doc page wants to inform its users which parameters are passed through or not, it's probably best if that's written by a human. — Chrisahn (talk) 22:32, 2 July 2026 (UTC)
Okay, I've converted the remaining two templates. I think we're done here. * Pppery * in solidarity 00:15, 3 July 2026 (UTC)
Awesome! Great job. It's been a plasure to watch you work. :-) By the way, let's not delete this section when we delete the module. Lots of interesting stuff that may be useful for further development. Should be kept somewhere, at least for a while. — Chrisahn (talk) 01:03, 3 July 2026 (UTC)
@BrandonXLF had some interesting ideas regarding named parameters that are also indexed, e.g. foo_1. As Brandon said, probably too much for Module:For nowiki, but interesting anyway. — Chrisahn (talk) 09:42, 3 July 2026 (UTC)
That's exactly what Module:ArgRest does? * Pppery * in solidarity 14:00, 3 July 2026 (UTC)

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.