From: Yuri T. <qar...@gm...> - 2008-10-13 17:28:21
|
> As a sidenote, I'm intrigued by the MarkdownParser class. One could > conceivably replace that class with their own which works differently > internally - as long as it has the same public methods and returns an > etree instance. This really opens up the possibility of > overriding/changing the core stuff. Cool! -- And if we want to change > the internal stuff, it should have little to no effect on the external > api. This wasn't the intension, but yes this is true. Note also that you use MarkdownParser's parseChunk() method in your custom parser. That is, you can parse certain things yourself, then delegate the rest to the original parser with parseChunk(parent, lines). Again, the main motivation for splitting was to make it easy for people (even myself!) to understand what does what. Now if you want to understand how high-level parsing works, you only need to review 362 lines, not 2000+. It also creates good granularity for adding unit testing. E.g., we can now write tests around MarkdownParser to keep track of both correctness and performance. -- http://sputnik.freewisdom.org/ |