MW

Tag diff

Recent Posts

Markdownify Tests and PEAR Text_Diff (April 01, 2011)

Yes, I’m finally gearing towards the release of my html2text.php successor, dubbed Markdownify. I’m using exessive testing and utilize the MDTest suite to find potential regressions etc. I’m really enjoying to program little CLI scripts with PHP, it just works like a charm.

Here’s an example of how my test suite currently looks like:

alt text

To the left is the original input (HTML), in the middle you find the generated Markdown and to the right HTML again - but now generated via PHP Markdown by Michel Fortin. The pretty colors mark changes between the two HTML versions. I use PEAR Text_Diff for this and a little of my own code. But since all of the existing diff engines for Text_Diff took ages for the Markdown Documentation (~400 lines afair), I wrote a Text_Diff engine which utilizes [shell_exec](http://www.php.net/shell_exec)() and GNU diff. This is blazingly fast and works like a charm! You can get the source code over at pastebin.org. Also take a look on the feature request I made. Dunno if this was the correct place for that…

continue reading...