The avoidance of substitution has being discussed a number of times and I have attempted to get this clarified a little, because as I understand it is fine for simple cases like this and a few others, and although may be eventually be deprecated, in favor of some of the features in V5.3.x it may still prove necessary until then.
Even then, I understand since to maintain backwards compatibility at most, it will be deprecated not removed.
If you look at the complexity of the code to avoid substitution altogether t is not as easy to use as simple substitution.
As a result we need to document when you should definitely avoid substitution and when its OK.
Unfortunately I don’t understand it enough (yet) to document this.
I think the subfilter operator and splitting the different elements is key here.
Using the different elements gives you much more flexibility.
In the code the sub variable is the substituted string, where the “text” elements are covered in single quotes … The “debug” line shows the sub-filter string.
It’s a bit trickier as it should be. … I’ll run a new test with the new \function definition from parametrized transclusions preview.