Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
nfm opened this Issue · 1 comment

2 participants

@nfm
Collaborator

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
Owner

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.

@netzpirat netzpirat closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.