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

Did brackets' behavior changed? #42

Closed
AlexanderPavlenko opened this issue May 14, 2012 · 3 comments
Closed

Did brackets' behavior changed? #42

AlexanderPavlenko opened this issue May 14, 2012 · 3 comments

Comments

@AlexanderPavlenko
Copy link

Not sure if it's a bug, but some existing code got broken.

> test1 = "%label{:for => 'gods_sake'} It fails (whyyyyy?)"
> HamlCoffeeAssets::HamlCoffee.compile 'test1', test1, false
ExecJS::ProgramError: Error: unclosed ( on line 4
from /home/alerticus/.rvm/gems/ruby-1.9.3-p125/gems/execjs-1.3.1/lib/execjs/external_runtime.rb:68:in `extract_result'

# but it works as expected with the linebreak and indentation

> test2 = "%label{:for => 'gods_sake'}\n  It fails (whyyyyy?)"
> HamlCoffeeAssets::HamlCoffee.compile 'test2', test2, false
=> "(function(context) {\n  return (function() {\n    var $o;\n    $o = [];\n    $o.push(\"<label for='gods_sake'>\\n  It fails (whyyyyy?)\\n</label>\");\n    return $o.join(\"\\n\").replace(/\\s(\\w+)='true'/mg, ' $1').replace(/\\s(\\w+)='false'/mg, '');\n  }).call(HAML.context(context));\n});"
@netzpirat
Copy link
Collaborator

Yes, the attribute parsing has changed from a plain RegEx approach to a mixed RegEx/Code approach, which allows me to handle the attributes in a more strict and robust way. Your snippet fails because the attribute parsing doesn't tollerate a wrong expression passed from the tag parsing anymore. You caught me at a perfect time, the current project is crap and every distraction is very welcome :P I'm looking at it now...

@AlexanderPavlenko
Copy link
Author

You rock :D Thanks a lot!

@netzpirat
Copy link
Collaborator

Just pushed 0.9.1 that fixes the bug. Thanks for reporting, I was awaiting the first attribute issue long ago.

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