slime-lang / slime

Minimalistic HTML templates for Elixir, inspired by Slim.
http://slime-lang.com
MIT License
371 stars 57 forks source link

Explicit <% end %> (- end) tags #146

Closed tmbb closed 7 years ago

tmbb commented 7 years ago

If I understand this code correctly, you seem to be useing some Regex-based "hack" to determine whether you need to add an <% end %> tag to the block. Since you're trying to keep "close to your elixir roots", wouldn't it be better to copy what EEx does and force the user to add the end tag explicitly? for example:

- condition = true
= if condition do
  p It was true.
- else
  p It was false.

would become:

- condition = true
= if condition do
  p It was true.
- else
  p It was false.
- end

I think this would be easier to compile and conceptually simpler because it'd be closer t normal elixir code.

Rakoth commented 7 years ago

-1 on this, @tmbb What is the problem with regex? I think, we should keep slim -> slime migration as easy as possible.

tmbb commented 7 years ago

What is the problem with regex?

It just seems brittle. But I admit I didn't try to "break" it to see how hard it would be. But yeah, compatibility with Slim is probably more important than this (I've never used Slim so I don't really care about compatibility).