Repeated HTML with embedded Ruby code (erb)

I am wondering if there is an existing solution for the following problem:

I have the following code:

<div> <div> <div><%= {:something => 'abc', :else => 'abc', :nice => 'ok'} %> </div> </div> </div> 

As you can see, it is untreated and hard to read. I was wondering if there is an existing tool in the ruby ​​that can re-document the document (no changes or validity to the source). Just a reindent.

Expected Result:

 <div> <div> <div> <%= {:something => 'abc', :else => 'abc', :nice => 'ok'} %> </div> </div> </div> 

Also, on the side, I don’t want to implement this as a command in Textmate.

+4
source share
1 answer

Implementation in Textmate? Do you know about ⌘βŒ₯[ ie Cmd+Alt+[ (or select it in the application menu using Text> Selection Selection)?

This is not exactly what you are trying to achieve in your example, but perhaps close enough. This is the result when applied to your code in Textmate:

 <div> <div> <div><%= {:something => 'abc', :else => 'abc', :nice => 'ok'} %> </div> </div> </div> 

It works in any Textmate package that supports padding.

-1
source

All Articles