Edge Rewrite
Jump to content

Module talk:For batched parameters

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia

Swap the order of size and sep

[edit]

I think we should swap the order of the size and sep parameters. sep may contain line breaks. Currently, the invocation then looks like this:

{{#invoke:For batched parameters|main|
|3|<nowiki>...</nowiki>}}

I think the following would be more readable:

{{#invoke:For batched parameters|main|3|
|<nowiki>...</nowiki>}}

Also, I'd say size is the more important parameter, so it also makes semantic sense for it to come first. — Chrisahn (talk) 01:56, 3 July 2026 (UTC)Reply

Done. * Pppery * in solidarity 02:20, 3 July 2026 (UTC)Reply
Awesome! — Chrisahn (talk) 02:22, 3 July 2026 (UTC)Reply

Should i be the index of the item or the batch?

[edit]

Currently, {{{i}}} is the index of the first item in the batch, i.e. if the batch size is 3, {{{i}}} will be 1, 4, 7... in consecutive runs of the code. I guess for most users of the module the index of the batch will be more useful, i.e. 1, 2, 3..., for example to number each batch output. — Chrisahn (talk) 02:07, 3 July 2026 (UTC)Reply

Done. * Pppery * in solidarity 02:20, 3 July 2026 (UTC)Reply
Great! — Chrisahn (talk) 02:22, 3 July 2026 (UTC)Reply
Of course, the user can calculate one index from the other by using {{#expr}}. Assuming batch size is 3:
  • Calculate batch index from first item index: {{#expr: trunc( ({{{i}}} + 2) / 3 ) }}
  • Calculate first item index from batch index: {{#expr: {{{i}}} * 3 - 2 }}
Things would be a bit simpler if we were dealing with the index of the last item in each batch:
  • Calculate batch index from last item index: {{#expr: {{{i}}} / 3 }}
  • Calculate last item index from batch index: {{#expr: {{{i}}} * 3 }}
Chrisahn (talk) 02:22, 3 July 2026 (UTC)Reply