Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for square brackets #32

Open
lloeki opened this issue Nov 26, 2014 · 4 comments
Open

Add support for square brackets #32

lloeki opened this issue Nov 26, 2014 · 4 comments

Comments

@lloeki
Copy link

lloeki commented Nov 26, 2014

With Slim, using CSS-style square brackets is useful to disambiguate between content and empty attributes.

This is extremely useful in some situations such as using web components (e.g with Polymer).

Example in Slim ported from the Polymer tutorial:

body[unresolved]
  core-header-panel

  core-toolbar
    paper-tabs[id="tabs" selected="all" self-end]
      paper-tab[name="all"] All
      paper-tab[name="favorites"] Favorites

  .container[layout vertical center]

This code in Ace currently generates e.g acontainer[layout tag and center] as content.

Current, ugly workaround is to use empty equals to force Ace to recognise the attributes as such instead of outputting layout vertical center as content:

body unresolved=""
  core-header-panel

  core-toolbar
    paper-tabs id="tabs" selected="all" self-end=""
      paper-tab name="all" All
      paper-tab name="favorites" Favorites

  .container layout="" vertical="" center=""
@yosssi
Copy link
Owner

yosssi commented Dec 19, 2014

I see. Please give me time to think about this.

@matejkramny
Copy link

@lloeki amber (https://github.com/eknkc/amber) does square brackets, maybe that would suit you more?

@jf
Copy link

jf commented Jun 18, 2015

@matejkramny amber looks interesting. But the square brackets seem mandatory: am I right? Not putting it down, btw. But I'd like to know.

@lloeki I've encountered the same problem u have with empty attributes. You dont actually need to specify the "" at the end. So the .container, for instance, can just simply be

.container layout= vertical= center=

Would be nice to have them be recognized as attributes still without the equal (tough request, yes I know!), but definitely still better than what you're doing now!

@matejkramny
Copy link

@jf yes correct, square brackets are necessary for attributes.

Looking at it now, it may not be optimal since square brackets are valid xml characters. If you need an attribute that needs square brackets, it sort of gets confusing rather quickly. eg: a[href="yeah" [ng-click="doYeah()"]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants