I really love Haml and its beauty, but some of its code really made my stomach turn. For instance, so many nasty hacks regarding loading of RedCloth and BlueCloth in both filters.rb and unit tests (those are even worse) and the over-complex default option handling in Haml::Engine#initialize.
I've rewritten the Engine#initialize option handling, as well as MarkDown, Textile and RedCloth filters to use lazy loading of associated libraries: http://pastie.caboo.se/80847 Haml was too tightly coupled with these libraries. Ever tried running unit tests when you don't have them installed? It's a disaster. The patch also cleans up the "no_bluecloth/redcloth" require hacks in unit tests, replacing them with much more readable test_lazy_filter_loading. I've completely removed the bluecloth/redcloth bits from the template tests, too, because there is no sense for Haml to unit test functionality of 3rd party libraries. Haml should just test the integration of its filters, and it does that pretty well in test_lazy_filter_loading (and other tests). Overall: - BlueCloth and RedCloth are required only when their filter classes get instantiated - nicer code = maintainability - users who don't have redcloth and bluecloth installed can now run Haml unit tests! - don't unit test Textile/Markdown features What has changed: - I've renamed Hash#rec_merge method to deep_merge, since the name is nicer and still self-descriptive - If you don't have RedCloth or BlueCloth, but use ":textile" or ":markdown" filters in Haml templates, this will not raise an error anymore! Haml will simply output the unprocessed source in the resulting template together with an ERROR notice. What do you think? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/haml?hl=en -~----------~----~----~----~------~----~------~--~---
