Possible solution for Angular2 syntax support #739

merged 1 commit into from Nov 28, 2016


None yet

2 participants

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 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 referenced this pull request Oct 18, 2016

Angular 2 bindings #683

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.

@sintro sintro referenced this pull request in slm-lang/slm Nov 10, 2016

Doesn't work with new Angular 2 attribute syntax #20

govorov commented Nov 26, 2016 edited

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:
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.


govorov commented Nov 28, 2016

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 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

1 check failed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
govorov commented Nov 28, 2016

Great! Thanks!

@yterajima yterajima added a commit that referenced this pull request Jan 18, 2017
@yterajima yterajima Possible solution for Angular2 syntax support in JP
related #739
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment