nested output rendering
kadru opened this issue · 6 comments
Hi,
In a brand new rails app with rails 6.1.7.3, slim-rails 3.6.2 and slim 5.1.1 for this view:
.col-sm-4 = t("title")
i.fas.fa-question-circle
I'm getting this:
<div class="col-sm-4">
<i class="fas fa-question-circle"></i>
<div class="col-sm-4">
<i class="fas fa-question-circle"></i>
</div>
</div>
but I was expecting something like this:
<div class="col-sm-4">
title<i class="fas fa-question-circle"></i>
</div>
I don't know if this is expected behavior, but this doesn't happens in rails 6.0.6.1, with same versions of slim gems. And is difficult to fix every view that can rendering like this since grepping it is too hard.
Here I made a repo to reproduce this, simply run bin/rails s
and you can see that behavior in the browser.
Which version of Temple do you use? Can you please test the different Temple versions 0.8.2, 0.9.0, 0.9.1, 0.10.0, 0.10.1 and 0.10.2. Unfortunately there has been a relatively recent change in the capturing infrastructure, which led to issues. In the recent releases there has been a bit of a back and forth related to those changes.
Regarding the syntax, I wonder if your snippet is correct. Did you mean this (note the do
)?
.col-sm-4 = t("title") do
i.fas.fa-question-circle
Or this?
.col-sm-4
= t("title")
i.fas.fa-question-circle
to get the expected output I have to write like this:
.col-sm-4
= t("title")
i.fas.fa-question-circle
Is hard to grepping it to get each one fixed and our test suite have certain gaps. Since this doesn't happens in rails 6 I supposed that is a bug.
Until now I tested with temple with versions 0.10.0, 0.10.1 and 0.10.2, the repo I have linked has temple with version 0.10.1. In all these versions I get the same behavior.
I will continue with versions < 0.10.0, but that require to downgrade slim, it will take some time.
Hi,
I have tested it with temple 0.8.2 and slim 4.1.0 with same output but I cannot tested it with versions 0.9.0 and 0.9.1, because there is not releases of slim compatible with these versions of temple.
Okay, from my understanding this is not a bug in Slim or Temple. The indentation in your code example is wrong, as mentioned in #921 (comment).