From: Ben W. <bw...@da...> - 2008-10-13 13:57:44
|
Anyway to get an advanced look at the new 2.0? I went looking on the site and only found 1.7... On 10/13/2008, "Yuri Takhteyev" <qar...@gm...> wrote: >I made a whole bunch of changes to the code, most of them just a >matter of refactoring, but some affect the functionality too. > >In terms of refactoring, the biggest change is splitting Markdown >class into three and making most of their methods private. I think >this will make it easier to understand the code: you can now study one >class at a time. Two of those three classes are still a little messy, >but at least the messiness is contained. > >So, we now have: > >1. MarkdownParser - parses pre-processed Markdown source into an ElementTree . > >Usage: > > tree = MarkdownParser.parseDocument(markdown_string) > >The only other exposed methods are parseChunk() and detectTabbed(). I >am tempted to hide them as well, but at the moment they are needed by >some extensions. > >2. InlineProcessor - runs inline patterns on an ElementTree > >Usage: > > InlineProcessor(patterns).applyInlinePatterns(tree) > >This is the only exposed method. I also folded into this the InlineStash cl ass. > >3. Markdown - puts it all together. > >Usage: > > Markdown(extensions).convert(markdown_string) > Markdown(extensions).convertFile(input_file_path, >output_path_or_stream, encoding) > >markdownFromFile() function still exists, but only has two lines now. > >Another change, which does affects functionality, is that I >incorporated Ben's treap implementation as a way of organizing >pre-processors, patterns, etc. This kills two birds: we now have a >better way of organizing those things, and this should also fix the >problem reported by Eric Abrahamsen last week, which required a major >change anyway. This breaks many extensions, and also breaks one >non-extension test. But 2.0 is about as good of a chance as we will >get for breaking backwards compatibility. > >I updated the footnotes extension as an example of how to use the new system . > >- yuri > >-- >http://sputnik.freewisdom.org/ > >------------------------------------------------------------------------- >This SF.Net email is sponsored by the Moblin Your Move Developer's challenge >Build the coolest Linux based applications with Moblin SDK & win great prize s >Grand prize is a trip for two to an Open Source event anywhere in the world >http://moblin-contest.org/redirect.php?banner_id=100&url=/ >_______________________________________________ >Python-markdown-discuss mailing list >Pyt...@li... >https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss |