Jump to content

Template talk:In string

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
(Redirected from Template talk:In string/doc)

Edit request 4 September 2024

[edit]

Follow-up to this topic.

{{In string}} is also affected by the Module:String bug: "plain mode" is disabled by default, whereas it was expected to be enabled by default.

We could modify this template to ensure "plain mode" stays disabled by default after the module is fixed, but I have better: let's right now switch this template to "plain mode" enabled by default.

I have reviewed the uses of this templates, and in all cases, "|plain=false" is present when required, or the pattern doesn't have special characters, so both enabled and disabled plain modes work. The only fixes I had to make are 1243726361 and 1243727056.

I think plain mode is better to be enabled by default, as it is less surprising (no mistakes because the user doesn't know about special characters), and it always has been the documented behavior. Also, plain mode should now be only marginally slower, thanks to this change.

So, here I'm asking to replace:

|source={{#invoke:String|find|source={{{source|{{{1|}}}}}}|target={{{target|{{{2|}}}}}}|start={{{start|{{{3|}}}}}}|plain={{{plain|{{{4|}}}}}}}}

with:

|source={{#invoke:String|find|source={{{source|{{{1|}}}}}}|target={{{target|{{{2|}}}}}}|start={{{start|{{{3|}}}}}}|plain={{#if:{{{plain|{{{4|}}}}}}|{{{plain|{{{4}}}}}}|true}}}}

Od1n (talk) 23:19, 3 September 2024 (UTC)[reply]

After the bug in Module:String is corrected, in this template and the other ones, we could simplify back to e.g. |plain={{{plain|{{{4|}}}}}}, or keep {{#if:{{{plain|{{{4|}}}}}}|{{{plain|{{{4}}}}}}|true}} so that we can know the default value by just looking at the template's code.
Default values of the plain parameter in Module:String:
  • true: find(), replace(), count()
  • false: match()
(btw, why such an inconsistent design…)
Od1n (talk) 15:30, 13 September 2024 (UTC)[reply]
Is this still needed, looks like the upstream change requested was already done? — xaosflux Talk 15:14, 28 October 2024 (UTC)[reply]
@xaosflux: yes, the change here is still needed. I didn't see any upstream change. Module:String still has to be fixed, and the change here is a prerequisite. Nevertheless, I think it's advisable that the client templates state the desired plain mode, instead of using the module default mode (which is harder to find, inconsistent as exposed above, prone to change, etc.). Od1n (talk) 07:32, 31 October 2024 (UTC)[reply]