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

hasBlock is true when it shouldn't be on new component syntax #338

Open atomkirk opened 4 years ago

atomkirk commented 4 years ago

This causes hasBlock to be true inside the avatar-image.{hbs|embl} when it should not be

      %AvatarImage @url=this.session.currentUser.avatarCloudFile.downloadUrl @name=this.session.currentUser.name
      = this.session.currentUser.shortName

If I use the older syntax, it seems to work

      = avatar-image url=this.session.currentUser.avatarCloudFile.downloadUrl name=this.session.currentUser.name
      = this.session.currentUser.shortName
ghost commented 4 years ago

This seems to be because angle bracket components are considered to have block if they have a closing tag. Emblem always produces:

<AvatarImage @url={{}} ... ></AvatarImage> vs <AvatarImage @url={{}} ... />

i am not that much of an expert of pegjs to be able to fix it quickly, looking at it, though.