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.
The actual code for Parse::replaceInternalLinks is a sort of explode engine. It starts off by exploding using [[, and it searches for ends and such, also taking into account Image: which can have recursive stuff. It's quite ugly, however it works. And I have been able to find good points to run callbacks in. 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.
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.
~Daniel Friesen(Dantman, Nadir-Seen-Fire) of: -The Nadir-Point Group (http://nadir-point.com) --It's Wiki-Tools subgroup (http://wiki-tools.com) --The ElectronicMe project (http://electronic-me.org) --Games-G.P.S. (http://ggps.org) -And Wikia ACG on Wikia.com (http://wikia.com/wiki/Wikia_ACG) --Animepedia (http://anime.wikia.com) --Narutopedia (http://naruto.wikia.com)
Rolf Lampa wrote:
Ilmari Karonen skrev:
Rolf Lampa wrote:
MW's and SMW's parsing of links isn't very impressing at the moment.
After all, from a user's viewpoint, pretty much the only syntactical difference between linking and transclusion is the shape of the brackets.
Hm, I'd say that it's about more than only keeping braces/brackets in balance. It's also about rules about the link-content which (should) determine whether the entire link should be skipped entirely or not (on syntax errors). Some rules requires unique logic and awareness of context.
But as said, I haven't either looked into how the logic for braces is structured (if it allows for _callbacks for example, such can be a risky though).
In any case, I'm onto learning some PHP and therefore I'll continue "playing around" with this for a while, if for no other good reason so for my own interest. :)
Regards,
// Rolf Lampa