machty / emblem.js

Emblem.js - Ember-friendly, indented syntax alternative for Handlebars.js
http://emblemjs.com
MIT License
1.04k stars 81 forks source link

multiline component bracket syntax is very sensitive to tabs vs spaces #248

Closed kjhangiani closed 8 years ago

kjhangiani commented 9 years ago

I actually posted this on the closed pull request that fixed this, but copying it here as a new issue:

Awesome, thanks for this. One thing I noticed - this seems to be pretty sensitive to tabs vs spaces, not sure if this is intended, but it's a little annoying. Here's an example, using \t and \s for tab and space respectively (extra space after indent sequences for clarity in example)

Doesn't work:

div
\t = inline-textarea [
\t\t prop1="someprop"
\t\t prop2=boundValue
\t ]

Works:

div
\t = inline-textarea [
\t\s\s prop1="someprop"
\t\s\s prop2=boundValue
\t ]

I prefer to use \t for indenting over \s because then each person can use their preferred editor settings for tab sizes, but now I'm forced to either convert tabs to spaces (which I hate), or remember that to indent inside [ ] syntax I have to use spaces.

It works as long as there is at least 1 space preceding each property, but fails if it's aligned with the = and ], or indented with a tab.

Is there any way this could be addressed? Is the bracket syntax used for any other type of parsing?

It would even be preferable if no indentation was required at all, as then I can just tab it to the same level and align it with the = and the ] bracket, even if it doesn't look nearly as pretty

lucasm-iRonin commented 8 years ago

I have a question about multiline stynax: how can I call a component using multiline with as? I.e. I have something like this:

bs-modal body=false header=false footer=false as |modal|
  ...

How can I write it using multiline syntax correctly?

bs-modal [
  body=false
  header=false
  footer=false ] as |modal|

Does not work.