How do you write:
= link_to 'Select »', "/"
in HAML properly?
= link_to 'Select »', "/"
just prints »
again.
ANSWER FROM Phrogz
= link_to('Select »'.html_safe,'/')
did the trick
In the simplest test, Haml does not futz with your HTML entities:
> require "haml"
#=> true
> Haml::Engine.new('%p= "See »"').render
#=> "<p>See »</p>\n"
Your problem is probably not Haml
, but rather explicit HTML escaping with link_to
or Rails itself.
For example, see this question and also:
Ruby on Rails seems to be auto-escaping html created by link_to
If you are using Haml with Rails, perhaps try:
= raw link_to('Select »','/')
Alternatively, I would just use proper Unicode throughout your pipeline so that there is no chance that an &
will be turned into &
accidentally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With