Template talk:For nowiki

Latest comment: 4 years ago by Pppery in topic Parameter to force one loop

Hi. This module is trippy. I think the name "for nowiki" is confusing and counterintuitive. You call a "nowiki" template ({{for nowiki}}), wrapping the wikitext in <nowiki> tags, and that produces rendered wikimarkup? That's pretty wild. --MZMcBride (talk) 03:31, 15 November 2017 (UTC)Reply

Help edit

Wondering if this template can display multiple instances of a template in a list.

*{{Moveable date |holiday=Fat Thursday |year=2018}}
*{{Moveable date |holiday=Fat Thursday |year=2019}}
:...
*{{Moveable date |holiday=Fat Thursday |year=2100}}

The only changing variable is the year. In practice it will be |year={{#time:Y|+X years}} with "X" being the variable number.

-- GreenC 01:55, 3 September 2018 (UTC)Reply

Hello it works Very Cool.

{{for nowiki|
|* {{Moveable date |holiday=Fat Thursday |year={{#time:Y|+{{{i}}} years}}}}|count=5}}

Produces:

  • February 27, 2025
  • February 12, 2026
  • February 4, 2027
  • February 24, 2028
  • February 8, 2029

Here in place: Shrove_Tuesday#Dates -- GreenC 02:22, 3 September 2018 (UTC)Reply

Parameter to force one loop edit

 – * Pppery * it has begun... 20:08, 21 January 2020 (UTC)Reply

I noticed that you reverted my edits to Module:For nowiki. You say you see no use for performing a single loop and you can perform it outside the template. While this is true, this would require copy and pasting code, just adding one parameter to the module makes more sense. And isn't the entire purpose of the template function is so the module can be used in other templates to replace those annoying cases were you have repeated code calling a increased number parameter over and over again? If not, than what is wrong with allowing this module to do that and what is its purpose?BrandonXLF (talk) 06:22, 21 January 2020 (UTC)Reply

First of all, the template function was intended to be used to replace a lot of pre-existing Lua modules, not to luafy new templates (see Wikipedia talk:Lua/Archive 7#Idea). Second, could you provide an example of a template on which this feature (in either form) would be useful? * Pppery * it has begun... 20:12, 21 January 2020 (UTC)Reply
@Pppery: There's talk of making a template like {{Wiktionary}} called {{Simple}} on the VP, it would be useful on both templates. It would be useful because they provide a default value, meaning one loop should be performed even if there's no parameters being sent to the template. Also, what is wrong with luafying new templates? I do realize that it is not the original purpose, but having a smaller call to a lua module is much better to maintain and read and allows for infinite parameters. Even if template is only for replacing existing modules, it should still be documented. This module could also be improved even more and used on more pages if it were to accept a prefix parameter so it loops through each argument with the format [prefix]x. This would not be as useful, but would still be useful. There's many more pages templates that could benefit from either feature.BrandonXLF (talk) 03:07, 22 January 2020 (UTC)Reply
OK, that establishes a use for this parameter in template, however I think it would be cleaner if you took a named parameter (default=?), and took the value to force from that parameter instead of always forcing the empty string if given. * Pppery * it has begun... 17:09, 22 January 2020 (UTC)Reply