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





--- Comment #65 from Robert Rohde <[email protected]>  2009-03-30 11:07:10 
UTC ---
Created an attachment (id=5978)
 --> (https://bugzilla.wikimedia.org/attachment.cgi?id=5978)
New version of string functions

The attached file is complete rewrite of the StringFunctions extension.

It implements the parser functions:

#len - string length
#pos - finding substring position
#rpos - reverse oriented #pos
#sub - fetch a substring specified by start and length
#replace - substring replacement
#explode - partition string by a delimiter and find a specific piece

The other functions, which are mostly already in the core, have been dropped.

In addition, I implemented it so that the unique markers generated by <nowiki>,
<gallery>, <math>, etc. are universally stripped (this is a partial change in
behavior from prior versions).  So the behavior will be more uniform and
predictable than prior versions and there is no risk of partial or unexpected
markers bleeding through.

Where possible PHP's built-in multi-byte string functions are used provide fast
results.  If the mb_ functions are unavailable, their behavior is simulated in
regex in order to provide a graceful (if slower) failure mode.

A global variable is used to define a hard limit for the size of a string to
operate on.  I've set this 1000 characters for now, but I haven't experimented
too much to decide what is reasonable or whether different limits should be
enforced for different functions.  #replace is armored against replacements
that would generate strings longer than this limit.

I believe that this version of StringFunctions (or something close to it)
should be suitable for implementation on WMF sites.


-- 
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 on the CC list for the bug.

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

Reply via email to