Reputation: 4421
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.
Upvotes: 5
Views: 9591
Reputation: 37349
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.
Upvotes: 11
Reputation: 6950
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
Upvotes: 2