I'm using CodeRay and Haml to do syntax highlighting on some pages, and I write a lot of Ruby code. The problem is when I have something like this:
%pre
%code.language-ruby
:preserve
def hello(name)
puts "Hello #{name}!"
end
I keep getting errors because Haml keeps trying to evaluate the name
variable inside the string, the #{var}
syntax is a pretty common idiom in Ruby code and there aremany places where it is used, but I cannot use syntax highlighting of those codes because Haml wants to evaluate those variables inside the string.
Is there a way to tell Haml to not do that in some places?
Is there a way to tell Haml to not do that in some places?
By escaping the #
:
puts "Hello \#{name}!"
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