I've been playing with haml 1.0.5 downloaded as a gem, after seeing
the ruby-talk announcement.
I've got a few comments:
(1) It doesn't work out-of-the-box as a standalone library when rails
is not installed.
$ cat haml.rb
require 'rubygems'
require 'haml/engine'
template = File.read('haml-sample.haml')
haml_engine = Haml::Engine.new(template)
puts haml_engine.to_html
$ ruby haml.rb
/usr/lib/ruby/gems/1.8/gems/haml-1.0.5/lib/haml/helpers.rb:231:
uninitialized constant ActionView (NameError)
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:
27:in `require'
from /usr/lib/ruby/gems/1.8/gems/haml-1.0.5/lib/haml/engine.rb:
1
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:
32:in `require'
from haml.rb:2
The solution was to add "module ActionView; end" to the top of my
program, but I think that haml/engine.rb should do this itself, i.e.
module ActionView
class Base
...
end
end
rather than "class ActionView::Base ..."
(2) A comment at the top of haml/engine.rb gives the example
# template = File.load('templates/really_cool_template.haml')
but if you try this, it throws a "private method" error. It should be
File.read(...)
(3) The rails download instructions at http://haml.hamptoncatlin.com/download
don't work - I get a 404 error for that URL. It seems that the files
have been removed? (This is with rails 1.1.2)
(4) I think there's a doc bug at http://haml.hamptoncatlin.com/reference.
Where it says "The pipe character designates a multiline string" it
gives a HAML example, and beneath that a compiled-to-HTML form, but
that doesn't appear to have been compiled properly.
(5) I was wondering why HAML has an explicit "empty tag" syntax, i.e.
%hr/, when I thought this could be implied automatically from the
indentation.
I can't think of any examples of pre-XHTML tags where you'd need and
explicit start and end tags *and* want to have empty content, e.g.
<span></span>.
(6) Tags which have content on the same line seem to cause some
strangeness if you also try to have nested content. For example,
%h1 foo
%hr
%hr
%br
test
Here's the rendered output:
<h1>foo</h1>
<hr>
<hr>
</hr>
<br>
</br>
test
</hr>
I was expecting:
<h1>foo
<hr>
</hr>
<hr>
</hr>
<br>
</br>
test
</h1>
But maybe I'm just doing something which isn't sensible anyway :-)
Regards,
Brian.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---