title: Nesting displayed when mapping collection in HAML
body: <p>I'm working on a Rails application, using HAML.  I needed to present a list to the user, when I stumbled upon this weird behaviour:</p>
  
  <p>This code generates no output, obviously.</p>
  
  <pre><code>- 5.times.map do |n|
    - n + 1
  </code></pre>
  
  <p>This code generates <code>1 2 3 4 5</code>, as it's outputting the return value for the inner statement.</p>
  
  <pre><code>- 5.times.map do |n|
    = n + 1                # Notice the =
  </code></pre>
  
  <p>This code generates <code>[1, 2, 3, 4, 5]</code>, as it's outputting the mapped array.</p>
  
  <pre><code>= 5.times.map do |n|     # Notice the =
    - n + 1
  </code></pre>
  
  <p>So far, so good...</p>
  
  <h1>This code generates <code>1 2 3 4 5 [0, 0, 0, 0, 0]</code>, as it doesn't like humans.</h1>
  
  <pre><code>= 5.times.map do |n|     # Notice the =
    = n + 1                # on both lines
  </code></pre>
  
  <h3>This code generates <code>1 2 3 4 5 [1, 1, 1, 1, 1]</code>, as it's nested in the <code>&lt;p&gt;</code>.</h3>
  
  <pre><code>%p                       # Here we are nested one &lt;p&gt; deep
    = 5.times.map do |n|
      = n + 1
  </code></pre>
  
  <h3>This code generates <code>1 2 3 4 5 [2, 2, 2, 2, 2]</code>, as it's double nested (and so on).</h3>
  
  <pre><code>%p                       # Here we are nested two &lt;p&gt; deep
    %p
      = 5.times.map do |n|
        = n + 1
  </code></pre>
  
  <p>Does anyone have an explanation for what is happening here in the HAML internals?  Is <code>= n+1</code> both adding a string to some output buffer, and then returning it's nesting level?</p>