Solved

Auto Tabifier/Indenter for .erb Ruby file

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

636 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