Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: haml to erb
Roy Wright
12/22/2008 6:04:00 AM
Thani Ararsu wrote:
> i have lot of haml file
> i want to convert all files to erb files
>
> any idea ?
Write a script to replace the ruby commands in each haml file with a
unique identifier while storing the ruby commands and identifiers in a
hash. Then generate html from the modified haml. Then replace the
unique identifiers with the ruby commands in the hash suitably wrapped
in erb syntax.
orignal haml:
#example
.name= foo.name
becomes:
#example
.name ERB00001
and hash would look like:
'ERB00001' => 'foo.name'
changed haml should generate:
<div class='example'>
<div id='name'>ERB00001</div>
</div>
Substituting from the hash with erb syntax should then yield:
<div class='example'>
<div id='name'><%= foo.name %></div>
</div>
BTW, just curious why are you going from haml to erb?
Have fun,
Roy
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: haml to erb
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password