Template talk:Str count

Any contributor may edit the template's sandbox. This template does not have a testcases subpage. You can create the testcases subpage here.

Template talk:Str count

Edit request 20 August 2024

A follow-up to this discussion: Template talk:Replace#Edit request 19 August 2024.

Please replace:

|plain={{{3|{{{plain}}}}}}}}</includeonly><noinclude>

with:

|plain={{{{{|safesubst:}}}#if:{{{3|{{{plain|}}}}}}|{{{3|{{{plain}}}}}}|true}}}}</includeonly><noinclude>

Current template behavior:

  • no plain parameter : literally "{{{plain}}}", which is (by chance) interpreted as "true" by the module.
  • plain parameter present but empty: erroneously interpreted as "false" by the module, instead of the expected default "true".

Fixed template behavior:

  • no plain parameter : explicitly pass "true" to the module.
  • plain parameter present but empty: explicitly pass "true" to the module, so we are good whether the module is fixed or not yet.

After the module is fixed, the template code could be simplified back to {{{3|{{{plain|}}}}}} (with a pipe after "plain", for cleanliness and robustness).

Od1n (talk) 04:30, 20 August 2024 (UTC)Reply

The invoke should work without passing any parameters, is that correct? — Martin (MSGJ · talk) 08:17, 20 August 2024 (UTC)Reply
No, Module:String only accesses frame.args, there is no other way such as using frame:getParent().args or passing a table. Therefore, the module can only be used by #invoke'ing from templates, passing the parameters to the #invoke. Od1n (talk) 09:18, 20 August 2024 (UTC)Reply
 Done Sohom (talk) 13:37, 20 August 2024 (UTC)Reply
This change has been reverted. It appears to have caused problems with {{OSM location map}}. Please test this change in the sandbox. An example affected page was Fremont Cannon. – Jonesey95 (talk) 14:25, 20 August 2024 (UTC)Reply
There was an extraneous }} in the applied edit. My code above was correct. Could you please make the change again? Od1n (talk) 17:51, 20 August 2024 (UTC)Reply
 Done Sohom (talk) 18:39, 20 August 2024 (UTC)Reply
The error should have been fixed and the edit reapplied, sorry I did not catch this Sohom (talk) 18:41, 20 August 2024 (UTC)Reply

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.