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

Setting delimiters to the current delimiters causes error #38

Closed
sl1m3d opened this issue Dec 27, 2012 · 10 comments
Closed

Setting delimiters to the current delimiters causes error #38

sl1m3d opened this issue Dec 27, 2012 · 10 comments
Labels

Comments

@sl1m3d
Copy link

sl1m3d commented Dec 27, 2012

When setting the delimiter to the original value when it's currently set to the original value causes an error.

@groue
Copy link
Owner

groue commented Dec 27, 2012

Could you please provide a short template that exhibits the problem, and the error message?

@sl1m3d
Copy link
Author

sl1m3d commented Dec 27, 2012

This produces an error: "Parse error at line 1: Unclosed Mustache tag"

id data = @{@"title": @"hello"};
NSString* template = @"{{={{ }}=}}{{title}}";
NSError *error = nil;
GRMustacheTemplate* mTemplate = [GRMustacheTemplate templateFromString:template error:&error];

This produces no error

id data = @{@"title": @"hello"};
NSString* template = @"{{={@ @}=}}{@title@}";
NSError *error = nil;
GRMustacheTemplate* mTemplate = [GRMustacheTemplate templateFromString:template error:&error];

This produces the same error, so it seems to occur when you try to set the delimiters to what they already are:

id data = @{@"title": @"hello"};
NSString* template = @"{{=[[ ]]=}}[[=[[ ]]=]][[title]]";
NSError *error = nil;
GRMustacheTemplate* mTemplate = [GRMustacheTemplate templateFromString:template error:&error];

@groue
Copy link
Owner

groue commented Dec 27, 2012

so it seems to occur when you try to set the delimiters to what they already are

Yes, indeed. The implementation of the parser doesn't like an opening token to be between an opening and a closing one, as in {{...{{...}}.

Are those templates machine-generated?

@sl1m3d
Copy link
Author

sl1m3d commented Dec 27, 2012

Kind of. The implementation I'm working on is being able to run through the same template a couple times with different delimiters each time by wrapping the template after each pass through in a string format delimiter change.

Edit: It's not really a big deal as I can always check before wrapping it, but it seems like a bug nonetheless.

@groue
Copy link
Owner

groue commented Dec 27, 2012

Yes, it seems like a bug. A pull request will be welcome, if you feel like fixing it.

@groue
Copy link
Owner

groue commented Dec 30, 2012

Actually I don't know where the bug is, in GRMustache, in the Mustache (non-specified) grammar, or in the "set delimiters tags" concept. I'm closing this issue as "won't fix".

Handlebars got rid of delimiter tags, and replaced them with backslash escaping. I tend to think it's a superior solution.

@Psybert, would you live if delimiters tags were replaced by backslash escaping of braces?

@groue groue closed this as completed Dec 30, 2012
@sl1m3d
Copy link
Author

sl1m3d commented Dec 31, 2012

Well I'll be using the set delimiters feature, but the backslash escaping seems to be pretty powerful as well.

groue added a commit that referenced this issue Feb 27, 2013
groue added a commit that referenced this issue Feb 28, 2013
@groue
Copy link
Owner

groue commented Feb 28, 2013

Reopening

@groue groue reopened this Feb 28, 2013
@groue
Copy link
Owner

groue commented Mar 5, 2013

This issue has been reopened because it will be solved when #45 gets fixed in the master branch.

groue added a commit that referenced this issue May 30, 2013
@groue
Copy link
Owner

groue commented May 30, 2013

Fixed in v6.7.2.

@groue groue closed this as completed May 30, 2013
@groue groue mentioned this issue Jul 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants