views:

25

answers:

1

I'm using HAML to make html templates but am having a problem in writing attributes which will be replaced with JavaScript string templating.

The line in question looks like this:

%div{:class => "<%= from_class %>"}

HAML tries to encode the <%= %> tags:

<div class="&lt;%= from_class %&gt;">

I don't want that to happen in this case... Anyone know how to do this?

+1  A: 

In the next version of Haml (3.1), there will be an :escape_attrs option that you'll be able to set to false to prevent this. You'll also be able to pass --no-escape-attrs on the command line. To use this right now, you can install the alpha version with gem install haml --prerelease.

nex3