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

Possible solution for Angular2 syntax support #739

Merged
merged 1 commit into from Nov 28, 2016

Conversation

govorov
Copy link

@govorov govorov commented Oct 9, 2016

Hi. There is a discussion about angular2 syntax support in Slim: #683

In current version full support is impossible due to default splats attributes syntax. So I changed parser behavior a bit and moved splat attributes regexp to an option with new default value, not conflicting with Angular2 *ng... syntax. Also attr delimeters set to curly braces only.

@minad
Copy link
Member

minad commented Oct 18, 2016

Thx for the suggestion!

I won't accept a breaking change since we can just handle that with configuration. Could you add an option splat_prefix => '*' which is then used by the regex? Then you could add a section to the readme about angular support, where you describe the required configuration.

@minad minad mentioned this pull request Oct 18, 2016
@govorov
Copy link
Author

govorov commented Oct 19, 2016

Thx for reply!
I reverted default options to their original values and added description in readme.
Looks like there is no breaking changes now.

@govorov
Copy link
Author

govorov commented Nov 26, 2016

Sorry for long delay.
Now I'm trying to fix broken tests and noticed, that master branch failed with the same errors, so I suppose problem is not in my patch.
Broken spec is:

  1) Error:
TestSlimEmbeddedEngines#test_render_with_builder:
NameError: undefined local variable or method `xml' for #<Env:0x00000001d762b0 @var="instance", @x=0>
    (__TEMPLATE__):3:in `block in singleton class'
    (__TEMPLATE__):-2:in `instance_eval'
    (__TEMPLATE__):-2:in `singleton class'
    (__TEMPLATE__):-4:in `__tilt_14400740'
    /home/travis/.rvm/gems/ruby-head/bundler/gems/tilt-199c9f7e170a/lib/tilt/template.rb:167:in `call'
    /home/travis/.rvm/gems/ruby-head/bundler/gems/tilt-199c9f7e170a/lib/tilt/template.rb:167:in `evaluate'
    /home/travis/.rvm/gems/ruby-head/bundler/gems/tilt-199c9f7e170a/lib/tilt/template.rb:102:in `render'
    /home/travis/build/slim-template/slim/test/core/helper.rb:22:in `render'
    /home/travis/build/slim-template/slim/test/core/helper.rb:45:in `assert_html'
    /home/travis/build/slim-template/slim/test/core/test_embedded_engines.rb:102:in `test_render_with_builder'

It's also impossible for me to create new entry in changelog, because I don't know what new gem version will be.

Thanks.

@govorov
Copy link
Author

govorov commented Nov 28, 2016

Hi.
I've done with splat_prefix option and test coverage for it. README is also improved.
Also made rebase for the sake of clear commit history.

@minad
Copy link
Member

minad commented Nov 28, 2016

Looks good! Thank you! I think I can merge this as it is.

@minad minad merged commit 53723a3 into slim-template:master Nov 28, 2016
@govorov
Copy link
Author

govorov commented Nov 28, 2016

Great! Thanks!

yuya-matsushima added a commit that referenced this pull request Jan 18, 2017
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

Successfully merging this pull request may close these issues.

None yet

2 participants