Daniel Friesen skrev:
Timstarling commented that adding links into the preprocessor would change they way they are handled and would break cases like http://sandbox.wiki-tools.com/edit/FakeLink changing the syntax of WikiText in an incompatible way.
Yes, that's a good example.
<...>However my issue lies in the |, there is no strict handling of those and making them "safe" is handled by parsing links inside of the links before the | is broken up. Works good for the parser, but not for anything you want to send to a callback.
A temporary hint for extension writers (until a final generic solution is available in the framework) is to count the brackets and count the pipes only while at the "main-link" level, that is:
0. Start a loop examining the string or string fragment. 1. Count UP on [ brackets. // $BracketsCnt++ 2. Count DOWN on ] brackets. // $BracketsCnt-- 3. Count | (pipes) ONLY when BracketsCnt equals two // if ( $BracketsCnt = 2 ) PipeCnt++ 4. Break loop if more than one pipe // if ( $PipesCnt > 1 ) Exit; was found
This would determine this syntax error in this link "[[ | | ]]" as well as in "[[ | [[ | | ]] ]]" (on the second call if called recursively).
So the plan is to actually build an object tree similar to the Frames and Parts the preprocessor uses. This'll allow for better handling of things inside of callbacks.
Which php file do you recommend me to start look at for this logic?
Regards,
// Rolf Lampa