From: "ara.t.howard" Date: 2009-03-24T23:54:38+09:00 Subject: Re: tagz-5.0.0 On Mar 24, 2009, at 4:40 AM, Brian Candler wrote: > Ara Howard wrote: >> tagz.rb is generates html, xml, or any sgml variant like a small >> ninja >> running across the backs of a herd of giraffes swatting of heads >> like a >> mark-up weedwacker. > > Looks interesting. > > Aside: people looking at this might also be interested in HAML. > Several > of your examples look very similar to how I use HAML with Sinatra. you mean combining erb with the dsl i assume? >> > def ajax_responder > haml :_ajax_table > end > > ... > @@ _ajax_table > %table > - rows.each do |row| > %tr > - row.each do |cell| > %td&= cell > > I can see that tagz works particularly well where you want to generate > HTML snippets directly inline with your code. The inline form of > HAML is > a bit icky because it needs to align with the left-hand edge. You > could > fix this with a helper, but I prefer partials because they are easily > precompiled and cached. i've used this def unindent! s indent = nil s.each do |line| next if line =~ %r/^\s*$/ indent = line[%r/^\s*/] and break end s.gsub! %r/^#{ indent }/, "" if indent s end def unindent s unindent! "#{ s }" end to get around that 'left hand side' issue. cheers! a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama