Difference between revisions of "Sequence"

From Sega Retro

(Created page with "I think the problem is actually <nowiki>{{{4}}}</nowiki> it appears that Mediawiki only evaluates arguments once, and it only does that when it finds a reference to one in th...")
 
 
(3 intermediate revisions by 2 users not shown)
Line 10: Line 10:
  
 
and then do a string replace on "$1" (Notepad++ uses $x for regex subtitutey bits). I tried doing a string replace on <nowiki>{{#var:{{{1|}}}}}</nowiki> but Mediawiki wasn't having it -[[User:Black Squirrel|Black Squirrel]] ([[User talk:Black Squirrel|talk]]) 14:58, 6 February 2018 (CST)
 
and then do a string replace on "$1" (Notepad++ uses $x for regex subtitutey bits). I tried doing a string replace on <nowiki>{{#var:{{{1|}}}}}</nowiki> but Mediawiki wasn't having it -[[User:Black Squirrel|Black Squirrel]] ([[User talk:Black Squirrel|talk]]) 14:58, 6 February 2018 (CST)
 +
: Same thing happens if I put <nowiki>{{{4}}}</nowiki> in a variable first. It seems like you can't have variables inside variables/params or something. - [[User:Hivebrain|Hivebrain]] ([[User talk:Hivebrain|talk]]) 15:08, 6 February 2018 (CST)
 +
:: I got it to work for unformatted text, so no expressions or templates, which makes its usefulness rather limited. Maybe one day loops will be updated to fix the variables incompatibility. - [[User:Hivebrain|Hivebrain]] ([[User talk:Hivebrain|talk]]) 11:50, 8 February 2018 (CST)
 +
:::How were you planning to use this, because the changes I've just done ''might'' get you there -[[User:Black Squirrel|Black Squirrel]] ([[User talk:Black Squirrel|talk]]) 14:45, 8 February 2018 (CST)
 +
:::: I had no specific plans, it was just an experiment. It seems like there's no way to get this template to function how I intended, but I should be able to reuse the general idea in releases templates. - [[User:Hivebrain|Hivebrain]] ([[User talk:Hivebrain|talk]]) 15:09, 8 February 2018 (CST)

Latest revision as of 16:09, 8 February 2018

I think the problem is actually {{{4}}}

it appears that Mediawiki only evaluates arguments once, and it only does that when it finds a reference to one in the code. So it's getting to {{{4}}} on the first loop, evaluating the argument, replacing the {{#var:region}} bit with "jp" and then doing nothing on the subsequent loops because in its mind, {{{4}}} has already been evaluated (so it just substitutes subsequent 4s with the one it's already done).

I don't know how you'd get around it - my only thought is to do something like this

{{sequence|region|,|jp,us,eu| 
* md_date_$1
}}

and then do a string replace on "$1" (Notepad++ uses $x for regex subtitutey bits). I tried doing a string replace on {{#var:{{{1|}}}}} but Mediawiki wasn't having it -Black Squirrel (talk) 14:58, 6 February 2018 (CST)

Same thing happens if I put {{{4}}} in a variable first. It seems like you can't have variables inside variables/params or something. - Hivebrain (talk) 15:08, 6 February 2018 (CST)
I got it to work for unformatted text, so no expressions or templates, which makes its usefulness rather limited. Maybe one day loops will be updated to fix the variables incompatibility. - Hivebrain (talk) 11:50, 8 February 2018 (CST)
How were you planning to use this, because the changes I've just done might get you there -Black Squirrel (talk) 14:45, 8 February 2018 (CST)
I had no specific plans, it was just an experiment. It seems like there's no way to get this template to function how I intended, but I should be able to reuse the general idea in releases templates. - Hivebrain (talk) 15:09, 8 February 2018 (CST)