Jump to content

Template talk:For nowiki

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

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]

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]