Hi,

We are upgrading the Haml library (from 2.0.7 to 2.2.8) used for our
Rails (2.2.3) application
We are seeing an issue where the result of a script ( = helper_method
(...) ) is appended to the wrong buffer in a specific case.

Here is a simple example that reproduces the issue (the actual logic
is actually spread over several helper methods like form helpers and
other view helpers):

In ApplicationHelper
def nested_captures
  capture do
    capture_haml do
      haml_concat "start"
      haml_concat(capture_haml {
        haml_concat "yeah"
        yield(self)
      })
      haml_concat "end"
    end
  end
end


And in the Haml template:
.section
  .message
    = nested_captures do |template|
      foo
      = succeed(",") do
        bar

With 2.2.8, we are getting:
<div class='section'>
  <div class='message'>
       bar,    start
              yeah
       foo


              end
  </div>
</div>

Looking at precompiler.rb, at the end of push_script:
push_and_tabulate([:loud, "_erbout << #{no_format ? "#
{output_temp}.to_s;" : out}",
  !(opts[:in_tag] || opts[:nuke_inner_whitespace] || @options
[:ugly])])

If we replace _erbout by _hamlout.buffer (like it was in 2.0.7)
push_and_tabulate([:loud, "__hamlout.buffer << #{no_format ? "#
{output_temp}.to_s;" : out}",
  !(opts[:in_tag] || opts[:nuke_inner_whitespace] || @options
[:ugly])])

then we get the expected result
<div class='section'>
  <div class='message'>

        start
        yeah
    foo
    bar,

        end
  </div>
</div>

This seems to indicate that _erbout is not set correctly for the =
succeed... .
Not sure why _erbout != _hamlout.buffer at that point but thought I
would ask if someone can shed some light on the issue before we dig
further.

Thanks,
David

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to