title: PHP possibilities in Slim Template language for Ruby
body: <p>In PHP I can do this:</p>
  <pre class="lang-php prettyprint-override"><code>&lt;div class=&quot;foo &lt;?php if($a) echo &quot;bar&quot;; ?&gt;&quot;&gt;
  &lt;?php if ($b) echo &quot;&lt;/div&gt;&quot;; ?&gt;
  </code></pre>
  <p>It is incredibly convenient. I can break a string in any place, between any quotes, between any HTML symbols, just wherever I want.</p>
  <p>And I need to implement the same in Ruby-HTML. I'm trying to port a PHP project to Ruby. I use the Slim template language. I tried this but it doesn't work, Slim throws errors:</p>
  <pre><code>&lt;div class=&quot;foo
  - if (x == 1)
    = bar
  &quot;&gt;&lt;/div&gt;
  </code></pre>
  <p>For now with Slim I know only one way:</p>
  <pre><code>- if (a == true)
     &lt;div class=&quot;foo&quot;&gt;&lt;/div&gt;
  - else
     &lt;div class=&quot;foo bar&quot;&gt;&lt;/div&gt;
  </code></pre>
  <p>Firstly, duplication. Secondly, my HTML-PHP part of code is quite complicated. It is with two loops (<code>for</code> loop and <code>foreach</code> loop inside it) and I use more than one such an embeds to add div's attributes according to conditions. And just cannot imagine how to implement it with Slim. It throws an error even for this, I cannot break long html string:</p>
  <pre><code>- if(i != 5)
    &lt;div class=&quot;foo bar&quot; 
    id=&quot;item_#{i}&quot; 
    style=&quot;background-color:red;&quot; 
    data-im=&quot;baz&quot;&gt;
    &lt;/div&gt;
  - else
  </code></pre>
  <p>Does Slim allow to break strings with conditional <code>if</code>s between quotes or element attributes? How to do it?</p>