Haml print at same line

2019-09-22 02:58发布

问题:

I want to print HAML at same line

  %ul
    - @categories.each do |c|
      %li= c.name 
      (#{c.posts.count})

and I recive

<ul>
  <li>vim</li>
  (3)
  <li>bash</li>
  (1)
</ul>

How to get

<ul>
  <li>vim(3)<li>
  <li>bash(1)</li>
</ul>

回答1:

Something like this should work:

%li= "#{c.name} (#{c.posts.count})"


标签: haml