Can you get the ERB properly indented when rendering?

I have several parts that I include in the Rails application.html.erb file , but the resulting HTML does not preserve my indentation (formatting). I was told that the first line receives the visualization with the same level of indentation as the call to _partial.html.erb , but all subsequent lines in partial order are simply left-aligned.

The result is code like (see my comments for positioning):

 <body> <div id="outer"> <div class="contentwidth main"> <div class="logo"> <<<<< Shouldn't be this far to the right <h1><a href="index.html">minimal.</a></h1> </div><!-- end logo --> <<<<<<< Shouldn't be way over to the left 

Is there a way to fix this / format my included particles better with ERB? Or do I need to use HAML?

+7
source share
2 answers

doc on filters contains an example of using the after filter to compress html before sending it to the browser.

Doing something similar, but using something like Tidy to reformat and replace the html, where this example does a compress, can do the trick.

+2
source

Not the answer you want - but - no, in Rails there is no built-in Rails to automatically indent ERP.

+3
source