Slim becomes painful when using Ruby function calls (i.e. Rails helpers). Sometimes these functions have long list of parameters and wrapping to next line sometimes becomes not so convenient. Moving, copying and pasting indented blocks is also quite painful and it's much harder to see nested structure than in, for example, Python code. Also it has complicated syntax for attributes and text content, especially text content. I have to look up its docs again and again. It reminds me of yaml which has the same problems (but much worse, yaml's documentation has size of a book).
However I'm not a fan of ERB or Django/Jinja template markups either. Indentation-based syntax has its advantages, it works well for Python and ML-like languages. Just Slim can be improved further.
Re:Foolproof HTML
by andrei_says_ on Sunday February 05, 2017 @02:37PM
(#13574108)
Would you consider pasting a sample? I do work with rails and can't think of a time when I have experienced this issue.
Maybe when passing multiple cars to a partial?
Re:Foolproof HTML
by icebraining on Saturday February 04, 2017 @03:51PM
(#13568978)
Seems similar to HTML generation libs in Lisp, except with indentation instead of parenthesis.
Yes, and here at least, I think indentation is a BIG win over parenthesis.
I disagree. When you want to move a block of code around, it makes it too easy to make mistakes. Or if you want to add e.g. a div around a bunch of other elements, you need to be very careful with the indentation.
I've worked with both: s-expression based syntax and whitespace-sensitive syntax. I'll take s-expression based syntax any time. Have you used both?
Yes, extensively.
In any half-way modern editor indentation-aware copy and paste/block indent/dedent is super easy.
> In any half-way modern editor indentation-aware copy and paste/block indent/dedent is super easy.
Sure. But I've made mistakes in Python because I didn't select e.g. the last line of a region.
If you've used both extensively and prefer whitespace to sexps, that's totally valid. De gustibus non est disputandum.
It produces standards-compliant HTML and prevents me from writing code that is not well-formed.
The above is a nice side effect of its incredibly clean and terse syntax.
Now I feel cheated any time I need to write regular HTML.
https://github.com/slim-template/slim/blob/master/README.md
I used emmet for a while but slim improves on writing and reading code.