From: Artem Y. <ne...@gm...> - 2008-07-15 15:21:03
|
I reformatted test suite, fixed a lot of bugs in version with ElementTree, and now all the test are working. I changed hrs handling because in NanoDOM version top level hrs surrounded with p tags, and p tags was stripped out in toxml method. Now LinePreprocessor replaces all hrs declarations with "___", then I added Markdown._processHR method, and in Markdown._processSection we now also checking for hr. But I also was forced to add this check to Markdown._processParagraph. Maybe the simplest and faster way of fixing it is just plain replace all "<p><hr /></p>" with "<hr />" after serialization, but then, we won't get valid ElementTree. Concerning attributes({@id=1234}), that was handled by NanoDOM, I added global function handleAttributes(text, parent), because it's required in inline patterns(ImagePattern) and also in Markdown class. Now we processing attributes in Markdown._processTree, after applying inline patterns, but still in same cycle. New version is slower then previous because of these changes, but still faster then new version with NanoDOM. I also fixed ticket #5 [1] in GSoC etree branch. Changing order of inline patterns works, but then other tests will fail. I changed BACKTICK_RE, to r'[^\\]\`([^\`]*[^\\]{0,1})\`' , after that evrything works fine, except of striping last character before backtick, for instance, "test `test`" -> "test</code>test</code>" instead of "test </code>test</code>", it's because of negative expression([^\\]) at the begining of regexp, so I decided to add to Pattern class attribute contentGroup, representing number of group, that we'd like to replace, by default it equals to 2. And changed regexp to r'([^\\])\`([^\`]*[^\\]{0,1})\`', so now we should use group 3 instead of group 2, and we creating pattern in that way: BacktickPattern(BACKTICK_RE, 3), joined group 1 and group 2 will be the string to the left of the match. [1]: http://www.freewisdom.org/projects/python-markdown/Tickets/000005 |