I've built a helper which returns the string which I supposed to insert into HTML.
I'm using Haml, so html.haml
file has this line:
= build_filetree 'small'
It rendered the result into this:
<ul class="filetree"><li><span class="folder">
folder</span></li><ul><li><
span class="file">nested_file1.rb</span></li><li><
spanclass="file">nested_file2.rb</span></li></ul><
li><span class="file">file1.rb</span></li><li>
<span class="file">file2.rb</span></li></ul>
But I expected this:
<ul class="filetree">
<li><span class="folder">folder</span></li>
<ul>
<li><span class="file">nested_file1.rb</span></li>
<li><span class开发者_JAVA技巧="file">nested_file2.rb</span></li>
</ul>
<li><span class="file">file1.rb</span></li>
<li><span class="file">file2.rb</span></li>
</ul>
What is the problem and how to fix it? Thanks
Just use raw helper. For example:
raw(“<ul class="filetree">...</ul>”)
精彩评论