I agree with a followup to this post by Hampton in that it
should not
have compiled due to the use of nested and
"same-line" content.
The gist of the rest of the discussion was that running Haml
under
JRuby was problematic when using blank lines.
I've experienced the same problem and had some partial
success in
getting haml 1.7 to work under jruby 1.0.1 with a simple
change.
In engine.rb, in do_precompile, on line 231, we have a line
of code
that reads:
uline = line.lstrip[0...-1]
Jruby certainly seems to have a bug - this line returns nil
with
passed a blank line.
Or more importantly the [...] operator returns nil for any
empty
string - which is a difference to the 1.8.6 MRI
implementation.
If I'm following the intention of that line then it's
removing the
last character, which presumably is an EOL character.
When running under JRuby the EOL is (at least on my machine)
2
characters: "rn".
Changing the line as follows has the desired effect and
avoids the
jruby bug.
uline = line.lstrip.chomp
I've no idea of the performance hit.
Given the use of [0...-1] using "chop" instead of
"chomp" would be
more equivalent, but I went for the safer option.
As I mentioned above - it's only a partial success. I'm
still
experiencing a few other problems which I've yet to
investigate.
Cheers,
James.
PS.
Sorry about posting this directly instead of replying, but
the google
groups interface has blocked replies to the original post.
On Jul 22, 7:02 am, Vlad Rafeyev <vla... gmail.com> wrote:
> It usual for me to use empty lines to structure
different blocks of
> code.
>
> For example I want to use this:
>
> %h2 Block number 1
> = render :partial => "num1"
>
> %h2 Block number 2
> = render :partial => "num2"
>
> But HAML says "no way":
>
> You have a nil object when you didn't expect it!
> The error occurred while evaluating nil.rstrip
>
> Why so? Why do I need to write my code
"line-to-line"? All languages
> just ignoring empty lines, but HAML makes problems of
them. Maybe
> there is a way...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
|