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

[2.3.0] settings.brackets no longer works #1314

Closed
nippur72 opened this issue Nov 6, 2015 · 5 comments
Closed

[2.3.0] settings.brackets no longer works #1314

nippur72 opened this issue Nov 6, 2015 · 5 comments
Assignees

Comments

@nippur72
Copy link
Contributor

nippur72 commented Nov 6, 2015

There are two issues with settings.brackets:

First:

riot.settings.brackets = "{{ }}";
var compiled = riot.compile("<my>{{time}} and {time}</my>",true);

results in no difference between the two "time"s:

compiled == "riot.tag2('my', '{time} and {time}', '', '', function(opts) {\n}, '{ }');"

Second issue is that there is still reference to settings.brackets somewhere in riot's code making it throw a lot of errors when I use custom brackets. The only way to make it work is to restore riot's default bracketing:

riot.settings.brackets = "{{ }}";
// tag registration here
riot.settings.brackets = "{ }";  // restores back riot's default brackets
@GianlucaGuarini
Copy link
Member

this is a bug @aMarCruz I have assigned it to you. Please let me know if we could solve it easily

@aMarCruz
Copy link
Contributor

I'll review this.

@aMarCruz
Copy link
Contributor

@nippur72 , I'm working in the fix.
For now, please use only the riot.util.brackets.set, parameter is the same as the value for riot.settings.brackets:
riot.util.brackets.set('{{ }}')
riot.util.brackets.set() or riot.util.brackets.set(null) reset brackets to default.

@aMarCruz
Copy link
Contributor

@GianlucaGuarini , I fixed this and other bug with tmpl.loopKeys, and its tests, in the dev branch of tmpl. The first bug is in the interaction of the compiler, brackets, and riot.compile when used riot.settings.brackets, the second is in the regexp for loopKeys not recognizing custom brackets.

I send a PR for riot in bug/1314 branch with a test for the first use (needs the dev version of tmpl).

btw: There are another (old) issue I found when changing brackets with the same expression: riot/tmpl#9; locking the brackets avoids the error, but I think this is not a priority.

@aMarCruz
Copy link
Contributor

This issue is fixed in the riot-compiler repository, it is not updated in npm yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants