Closed sl1m3d closed 11 years ago
Could you please provide a short template that exhibits the problem, and the error message?
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];
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?
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.
Yes, it seems like a bug. A pull request will be welcome, if you feel like fixing it.
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?
Well I'll be using the set delimiters feature, but the backslash escaping seems to be pretty powerful as well.
Reopening
This issue has been reopened because it will be solved when #45 gets fixed in the master branch.
Fixed in v6.7.2.
When setting the delimiter to the original value when it's currently set to the original value causes an error.