k0kubun / hamlit

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

Intended behaviour? #110

Closed sixtyfive closed 7 years ago

sixtyfive commented 7 years ago
- ################
- # Show TinyMCE #
- ################

- if current_user && current_user.is_admin? && params[:view_mode] != 'preview'
  %div#content.editor
    %form{method: :post}
      %textarea{name: :data_fragment_html}= @contents

- ###################
- # Just plain HTML #
- ###################

- else
  %div#content.user
    = @contents

Results in: Hamlit::HamlSyntaxError - Got "else" with no preceding "if". It's not a big problem, but it'd have been nice to have those comments there like that. (And yes, I know that I should be using partials here, it's really just something that would've been nice if it was possible).

k0kubun commented 7 years ago

At least it's intentional for Hamlit because it intends to be compatible with Haml. But it's considered a bug in Haml https://github.com/haml/haml/issues/815.

Hamlit uses the same parser as Haml and this is parser issue. We need to fix this in Haml first. Hamlit basically backports it from Haml. Closing in favor of https://github.com/haml/haml/issues/815.