OK, I was trying to use -# instead of patching haml and adding nothing filter.
It worked for couple of files but it is not satisfactory solution. Problem is that -# doesn't really work like nothing filter. It does, until you come to first empty line in old html you didn't converted yet. Then everything explodes. This thread is month old so let me recapitulate. you have big html file you want to convert: ------------------------------- <div>something something else</div> and then<b>bold</b> <span>another html</span> more html.... more html ... ------------------------------- Now, obviously converting all of it is quite a job, so let's go gradually: ------------------------------- %divsomething something else :nothing and then<b>bold</b> <span>another html</span> more html.... more html ... ------------------------------- So, I simply converted first few lines, and added nothing filter before unconverted text. Now I can try to render it and see how it goes. Then I can gradually, convert the rest. So, Nathans idea was to use -# instead,and I wasn't aware of it: ------------------------------- %divsomething something else -# and then<b>bold</b> <span>another html</span> more html.... more html ... ------------------------------- OK, in any good editor, you can easily select text and movie it two spaces right, but this doesn't solve problem, because those empty lines will turn off -# and start haml filter again and produce error. Point is I don't want old html rendered, so :plain filter is of no use. I don't want to see stuff twice (especially if I render partials). So, I still think nothing filter is nice idea for gradually converting html to haml, but patching haml all the time is too expensive for me (multiple projects, multiple machines) especially since you moved everything to gem. So, I'll just manually delete empty lines until you guys decide on it. On Dec 10 2007, 5:41 am, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote: > But isn't this what -# is for? > > Hampton wrote: > > That's pretty cool man. > > > Nice use of filters there! That's one area where I'm excited to see > > what people come up with in the future.... filters! > > > Did you blog about this somewhere? > > > -hampton. > > > On Dec 9, 2007 6:06 AM, [EMAIL PROTECTED] > > <[EMAIL PROTECTED]> wrote: > > >> When I started using haml, I had bunch of rhtml to convert to haml. > > >> So, I saved rhtml file as haml and started working. > > >> But I was new to haml and most of the files were too long to be > >> converted all at once. Also, I didn't like the idea, of making one > >> more backup file and move piece by piece to haml file. > > >> And sometimes, when I needed things working quickly, I didn't want to > >> convert everything, just some pieces I needed. > > >> Then, I read about filters and decided to implement my own. > > >> It's callednothingfilter, because it rendersnothing, really handy > >> to convert from old rhtml, html or even php. For example: > >> --------------------------------------------------- > >> %p already converted > > >> :nothing > >> <table> > >> <tr> > >> <td>this is old stuff not yet converted</td></td> > >> --------------------------------------------------- > > >> In this way, I can easily test piece by piece for haml errors and > >> proper rendering. This is especially usefull for people who are new to > >> haml (like me at that time). > > >> So, if you like the idea, you can include it in next version. Change > >> is trivial: > >> engine.rb: > >> ---------------------------------------------------- > >> 'nothing' => Haml::Filters::Nothing, > >> ---------------------------------------------------- > >> And filters.rb: > >> ---------------------------------------------------- > >> classNothing > >> def initialize(text) > >> @text = text > >> end > >> def render > >> "" > >> end > >> end > >> ---------------------------------------------------- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
