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

Failing to quote object literal keys causes an 'unmatched OUTDENT' error #49

Closed
nfm opened this issue Jun 19, 2012 · 1 comment
Closed

Comments

@nfm
Copy link
Collaborator

nfm commented Jun 19, 2012

The following should be valid haml/coffeescript, but causes an unmatched OUTDENT error:

%input{ type: 'text', name: 'padded_number', value: myFunction(@number, length: 3 ) }

However, it only breaks in the context of haml. This compiles without error:

= myFunction(@number, length: 3)

These other syntaxes don't work:

%input{ type: 'text', name: 'padded_number', value: myFunction(@number, { length: 3 }) }
%input{ type: 'text', name: 'padded_number', value: myFunction(@number, 'length': 3 ) }
%input{ type: 'text', name: 'padded_number', value: myFunction(@number, { 'length': 3 } ) }

The only syntaxes that work require the key to be quoted, and separated from the colon by a space. Curly braces are optional:

%input{ type: 'text', name: 'padded_number', value: myFunction(@number, { 'length' : 3 } ) }
%input{ type: 'text', name: 'padded_number', value: myFunction(@number, 'length' : 3 ) }
@netzpirat
Copy link
Collaborator

I had the improve the attribute parser in Haml Coffe, so that valid keys identifiers (like length: 3) within parenthesis are kept in the attribute value. You're code snippets are now part of the spec suite. Thanks for reporting.

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

2 participants