k0kubun / hamlit

High Performance Haml Implementation
https://rubygems.org/gems/hamlit
Other
981 stars 59 forks source link

I think there is a bug how "\" escapes. #123

Closed dn closed 6 years ago

dn commented 6 years ago
.foo \#{this_is_escaped_and_not_interpreted}
.bar
  \#{hamlit_tries_to_interpreted}

I expected that the .bar example is also ignored and not interpreted. If you agree I would look into the source and try to find it. Could you point me to the source where the escaping via "\" is done?

k0kubun commented 6 years ago

For the easiness to migrate from Haml, basically Hamlit aims to be the same as the latest Haml except some intentional changes written in REFERENCE.md.

$ cat a.haml
- this_is_escaped_and_not_interpreted = 'escaped'
- hamlit_tries_to_interpreted = 'interpreted'
.foo \#{this_is_escaped_and_not_interpreted}
.bar
  \#{hamlit_tries_to_interpreted}

$ haml -v
Haml 5.0.4

$ haml a.haml
<div class='foo'>#{this_is_escaped_and_not_interpreted}</div>
<div class='bar'>
interpreted
</div>

$ hamlit version
2.8.8

$ hamlit a.haml
<div class='foo'>#{this_is_escaped_and_not_interpreted}</div>
<div class='bar'>
interpreted
</div>

So this seems not a bug. Please consult Haml repository first. Actually Hamlit uses Haml's parser and changing Haml would easily fix this issue in Hamlit as well.

dn commented 6 years ago

Thank you for the quick response!