|
List Info
Thread: Feedback on haml 1.0.5
|
|
| Feedback on haml 1.0.5 |
  United States |
2007-02-27 06:59:04 |
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:2
31:
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.ha
mptoncatlin.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 haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Feedback on haml 1.0.5 |
  United States |
2007-02-27 13:04:29 |
1, 2: Fixed in Trunk.
3: I forgot the "svn." subdomain. Fixed.
4: Fixed on the website and in Trunk.
5: There are two reasons for this: one is because some
browsers don't
understand some self-closed tags (ever tried viewing a page
with a
<div/> in Safari? It's not pretty), and the other is
backwards
compatibility. There needs to be some way to differentiate
between
self-closed and non self-closed tags, and Hampton chose the
"/" syntax.
Although, in retrospect, it might have been a better choice
to have a
tag that specifies that an empty tag shouldn't be
self-closed, at this
point, it would break too many layouts with empty divs that
it's not
practical to make the switch.
6: Tags with inline content and nested content are invalid
Haml syntax -
you're trying to provide content twice. This throws an error
in Trunk,
which should get rid of any confusion.
Thanks for all the reports! This is how we know stuff is
breaking .
Thanks for the questions, too - it's good to know what
confuses people.
That's how we figured out where to throw errors in the first
place.
- Nathan
candlerb wrote:
> 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:2
31:
> 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.ha
mptoncatlin.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 haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Feedback on haml 1.0.5 |
  United States |
2007-02-28 04:08:24 |
> 3: I forgot the "svn." subdomain. Fixed.
Thanks. There's some strangeness from the SVN pathname
though: when I
follow the instructions to install HAML stable, it installs
into
directory "vendor/plugins/stable" (rather than
haml). It needs "script/
plugin remove stable" to uninstall it. Similarly,
installing trunk
gives me "vendor/plugins/trunk"
I guess it's no big deal to rename the directory after
installing it
though, but it might be worth a mention in the installation
instructions. Or you can reorganise the repository into
.../tags/
stable/haml and .../trunk/haml
> 5: There are two reasons for this: one is because some
browsers don't
> understand some self-closed tags (ever tried viewing a
page with a
> <div/> in Safari? It's not pretty)
I understand that; a HTML browser will see this as a start
tag and be
hunting for a matching end tag somewhere else. But is it
ever useful
to generate an empty <div></div> section within
a page? Possibly if
you're doing AJAX stuff I guess.
Cheers,
Brian.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Feedback on haml 1.0.5 |
  United States |
2007-03-01 11:56:22 |
The directory name is an unfortunate confluence of a
not-great
repository naming scheme on our part and a lack of
functionality on
the part of the Rails plugins script, in that it doesn't
allow one to
choose the name of the resulting plugin directory. We may
change the
repository layout in the future, but we don't want to break
people who
are using it at the moment.
<div></div> is actually quite useful in
CSS-based layouts; although
somewhat bad style to have a non-semantic div tag, it's
occasionally
necessary and quite useful to be able to have a box that you
can do
whatever you want with. I first encountered the Safari bug
when doing
just that. It's also useful for Ajax, as you said.
- Nathan
On Feb 28, 2:08 am, "candlerb" <b.cand... pobox.com> wrote:
> > 3: I forgot the "svn." subdomain.
Fixed.
>
> Thanks. There's some strangeness from the SVN pathname
though: when I
> follow the instructions to install HAML stable, it
installs into
> directory "vendor/plugins/stable" (rather
than haml). It needs "script/
> plugin remove stable" to uninstall it. Similarly,
installing trunk
> gives me "vendor/plugins/trunk"
>
> I guess it's no big deal to rename the directory after
installing it
> though, but it might be worth a mention in the
installation
> instructions. Or you can reorganise the repository into
.../tags/
> stable/haml and .../trunk/haml
>
> > 5: There are two reasons for this: one is because
some browsers don't
> > understand some self-closed tags (ever tried
viewing a page with a
> > <div/> in Safari? It's not pretty)
>
> I understand that; a HTML browser will see this as a
start tag and be
> hunting for a matching end tag somewhere else. But is
it ever useful
> to generate an empty <div></div> section
within a page? Possibly if
> you're doing AJAX stuff I guess.
>
> Cheers,
>
> Brian.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
[1-4]
|
|