From: Waylan L. <wa...@gm...> - 2007-09-20 15:08:43
|
For as long as I can remember the following comment has been in the CorePatterns class: """This class is scheduled for removal as part of a refactoring effort.""" My question is; what would that refactor entail? Is there any help I can provide? The reason I ask is highlighted in ticket #1793419 [1]. I'm sure the quick fix I provide there isn't anywhere near the goal of the refactor. The way I see it. the problem is that while one could override the patterns within CorePatterns, is is currently very difficult to override the code that uses those patterns. It is even more difficult to add your own patterns. As the comments suggest just above the CorePatterns class, we should try to use preprocessors, inlinepatterns or postprocessors if possible. While understandable, when working with block level markup, preprocessors don't output to the dom, inlinepatterns will get wrapped in blocklevel elements defined in CorePatterns (block level elements would get inappropriately wrapped in <p> tags, for example) and, by the time we get to postprocessors, it's a little late. The example I give in the ticket is adding header ids as php markdown extra does [2]. I could use a preproccesor to extract the id, but now I need to store it in some way that I know which header it goes with. Then, how would I add that id to the header? A postprocessor would be ugly here. The best would be to override the code that puts the header into the dom. But that is buried in the core. If I'm doing that, I might as well override the header corepattern. I'm not posting this to complain. I'd just like to see that refactor move forward if that's still the plan. If I can help, even better. The problem is, I don't know what the plan is, so its a little difficult to help. At the same time I realize this is complex stuff. PS: As a side note, python-markdown eats php markdown extra's header id syntax. The header is completely stripped from the output. At the very least, I would have expected it to be wrapped in a <p> tag. At best I would have expected the header without the id. Initially, I was surprised no one implemented this extension yet. Now I know why. It's currently too hard. [1]: https://sourceforge.net/tracker/?func=detail&atid=790198&aid=1793419&group_id=153041 [2]: http://michelf.com/projects/php-markdown/extra/#header-id -- ---- Waylan Limberg wa...@gm... |