Another stupid HAML question. I need to escape HTML in plain strings, without "=":
%p
This paragraph has <n> lines.
Whatever I do (like prepending "&"), it still renders as
This paragraph has lines.
I am using Rails 3.1.
Yes, you can escape HTML with :escaped
filter.
Works the same as plain, but HTML-escapes the text before placing it in the document.
Example:
%p
:escaped
This paragraph has <n> lines.
Check the HAML documentation here: http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#escaping_html
There might be a better way of doing it, but this does work:
& This paragraph has #{"<n>"} lines
That will generate
This paragraph has <n> lines
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