Solved

Auto Tabifier/Indenter for .erb Ruby file

Posted on 2010-09-15
4
833 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
The viewer will learn how to dynamically set the form action using jQuery.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

710 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