Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Document gotcha with string interpolation
Resolves #832
  • Loading branch information
norman committed Jun 8, 2015
1 parent e194017 commit 7c7c169
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions REFERENCE.md
Expand Up @@ -1021,6 +1021,21 @@ might compile to:
//]]>
</script>

#### Gotchas

Haml uses an overly simplistic regular expression to indentify string
interpolation rather than a full-blown Ruby parser. This is fast and works for
most code but you may have errors with code like the following:

%span #{'{'}

This code will generate a syntax error, complaining about unbalanced brackets.
In cases like this, the recommended workaround is output the code as a Ruby
string to foce Haml to parse the code with Ruby.

%span= "#{'{'}"


### Escaping HTML: `&=` {#escaping_html}

An ampersand followed by one or two equals characters evaluates Ruby code just
Expand Down

0 comments on commit 7c7c169

Please sign in to comment.