Solved

Auto Tabifier/Indenter for .erb Ruby file

Posted on 2010-09-15
4
824 Views
Last Modified: 2013-11-19
I have some code, as seen below. Is there any free online tool I can use to tidy up the indents as it has been done by several different developers and is really messy at the moment.

It's not completely HTML so I can't use the straight HTML tabifier.
<div id="two-column" class="clearfix">
  <div class="left">
	<h2>Why Choose Pick A Quote?</h2>
	Our intelligent system matches you with the right providers. This ensures you get the right people for your job. About 2-3 lines of text needed here.<br /><br /><a href="how-it-works">How It Works >></a>
	<br /><br />
	<h2>Popular Categories</h2>
    <table id="categories">
      <%- @categories.in_groups_of(3, false) do |group| %>
        <tr>
          <%- group.each do |category| %>
            <td class="popular"><%= link_to category.name, subcategory_path(category) %></td>
          <%- end %>
        </tr>
      <%- end %>
    </table>
	<div style="padding-top: 8px"><%= small_button_link "View all categories", categories_url %></div>
	<br /><br />
	<div class="columns clearfix">
      <div class="col-3">
        <h2>For Consumers</h2>
        <p>
          If you need something done, the benefits of PickAQuote.com.au are tremendous
        </p>
        <%= big_button_link "Create Account", signup_url %>
      </div>
      <div class="col-3 last">
        <h2>For Businesses</h2>
        If you are a business and want to win more work, new leads will be sent to your inbox for free
      </div>
    </div>
  </div>
  <div class="right clearfix">
	<%= render :partial => "shared/modules/post_your_job"%>
    <%= render :partial => "shared/modules/promote_your_business" unless current_user %>
    <%- module_box "Latest Jobs" do %>
      <%- @jobs.each do |job| %>a
        <%= link_to job.title, job %>
        <br />
        <span class="subtext"><%= "#{job.location.value if job.location}" %></span>
        <br /><br />
      <%- end %>
	  <div style="text-align: right"><a href="/categories" class="more-jobs">More</a></div>
    <%- end %>
  </div>
</div>
<%- content_for :header do %>
<div class="title">We Find The Right Professional For You</div>
<div align="center" style="padding-bottom: 7px">
	<table> 
		<tr> 
			<td class="how-it-works-1">Need work done?<br />Post your job</td> 
			<td class="how-it-works-arrow"></td>
			<td class="how-it-works-2">Businesses compete<br />for your work</td>
			<td class="how-it-works-arrow"></td>
			<td class="how-it-works-3">Pick the best,<br />save time and money!</td> 
		</tr> 
	</table>
</div>
<%- end %>

Open in new window

0
Comment
Question by:hubfub
  • 2
4 Comments
 
LVL 12

Expert Comment

by:JESii
ID: 33687887
You might try Vim (Vi Improved) at http://www.vim.org. It recognizes lots of different languages, including rails, has a smart indenter, and tons of plugins that are very useful.  For example, here's a link that talks about using Vim with Rails (not exactly on-topic, but indicative of what you can do with Vim).
0
 
LVL 1

Author Comment

by:hubfub
ID: 33688166
Is there something a bit easier to use than this?
0
 
LVL 12

Accepted Solution

by:
JESii earned 500 total points
ID: 33688481
Try this: http://infohound.net/tidy/ 

It does HTML cleanup, and -- since the erb commands are enclosed in angle brackets, it may work.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question