Last modified: 2009-03-17 02:38:00 UTC
Created attachment 5528 [details] patch against r43444 (see comment) Hello, there where many requests for generic loop functions. I don't think that this genericity is really needful, but a function to split a string by a delimiter and do something for each substring would be. Consider you want to make a wiki list of "a/b/c/d". Currently it is posible to some degree using #titleparts. And it is done already this way, and by likely bad hacks as well ([[Template:Loop]]). It would be much more easy (and I think it'd go easy on resources, too) if you could iterate the parts like that: {{#foreach:a/b/c/d|/|n|<nowiki /> * {{{n}}} }} where the first parameter is the string to split, the second is the delimiter and the third is the variable to contain the substrings. The last parameter is the action to be done for each substring. I wrote a little extension to provide just that. Unfortunately, I don't know how to count the ressources used, so someone had to add this.
http://www.mediawiki.org/wiki/Extension:ForeachFunction http://www.mediawiki.org/wiki/Extension:LoopFunctions http://www.mediawiki.org/wiki/Extension:Loops There are at least 3 extensions that do this now. These most likely won't be included in the ParserFunctions extension. If you want one of these enabled on Wikimedia that would be a separate bug.