Finally, I’ve done it... "A Modified Snippet Parser")))
As some of you know, current MODx snippet parser has some problems: it fails to parse snippet correctly, if any of its parameter values contains symbols ’=’ or ’&’. I’ve been tired to think out different tricks to avoid that problem, so I tried to fix the problem from within. As a result, I modified function
evalSnippets in document parser object. Now I will describe modified function and it’s features...
- at first, the code of function was cleaned and slightly optimized
- of course, snippet syntax is not changed. This function provides all functionality that the original one do. The rules are old: you should enclose snippet parameter values with ’`’ if parameter value has more than one word (word is meant to be a sequence of digits, letters and underscore character (_))
- it removes problem with ’=’ and ’&’ characters. You can use even ’`’ character, but it should be escaped with backslash, i.e. it should be written as ’\`’ inside parameter value enclosed by ’`’
- you can use multiline snippets, i.e. you can place every snippet parameter on a separate line. I think, sometimes it’s very comfortable. Remember that you should leave opening square brackets, snippet name and question mark tightly, without any space and on a single line ([[snippetName? .......]]
- you can use some kind of comments between parameters, because all text outside parameters is ignored.
So here is an example:
[[snippet? ¶m = 23 //this snippet will work
¶m2 = 12ds_a345 - this will be treated as one word, so you can leave it as is
¶m3 = `See me? Lisa&Mike=Fun.` - and this value contains several words,
so it should be enclosed by '`'. And as you can see, you are
able to use '=' and '&'
¶m4=`Testing char\`. Good` - that's correct - escaped character '`'
As you can see any text outside parameters is ignored,
so you can use this feature... or bug... to make some comments
to your snippet parameters
]]
And finally... Where’s the function?

It is attached below))) Hope, it will be useful.
If you have some suggestions or if you will find some bugs - please, let me know (i haven’t found yet

).