https://bugzilla.wikimedia.org/show_bug.cgi?id=16340

           Summary: Provide a #foreach function
           Product: MediaWiki extensions
           Version: any
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: need-parsertest, need-review, patch
          Severity: enhancement
          Priority: Normal
         Component: ParserFunctions
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


Created an attachment (id=5528)
 --> (https://bugzilla.wikimedia.org/attachment.cgi?id=5528)
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.


-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are watching all bug changes.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to