Solved

Auto Tabifier/Indenter for .erb Ruby file

Posted on 2010-09-15
4
821 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Specific format 21 140
Import csv files to MS SQL 5 60
Summernote and form validation 10 40
Adding a hidden div to each row in a table 6 23
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

707 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now