Prevent indentation of html markup inside an ERb if statement?

I there any way to prevent the IDE from indenting html markup inside an ERb if statement? The "Code > Reformat Code.." menu item always erroneously indents this code.

For example the following code snippit is formatted like this:

<% if @current_user.is_admin? %>
    <td >
        <div ><%= project_actions_html(project) %></div>
    </td>
<% end %>



Though it should really be formatted like this:

<% if @current_user.is_admin? %>
<td >
    <div ><%= project_actions_html(project) %></div>
</td>
<% end %>

2 comments
Comment actions Permalink

I've not seen other developers format if blocks like this. Tyipically, it is formatted as such:

<% if @current_user.is_admin? %>
  <td >
    <div ><%= project_actions_html(project) %></div>
  </td>
<% end %>


The contents of an if block are indented.

0
Comment actions Permalink

It's not the if formatting I'm concerned about, it's the outputted HTML formatting which is not indented correctly (because the way the if block is formatted).

Using the current enforced formatting you get output like this:

<table>     <tr>             <td></td>     </tr> </table>



When it should be like this:

<table>     <tr>         <td></td>     </tr> </table>

0

Please sign in to leave a comment.