Closed artem-alexandrov closed 11 years ago
Could you please provide some sample code?
Of course, here it is:
NSString *theTemplate = @"{{ count(array) }}";
NSError *error = nil;
GRMustacheTemplate *parsedTemplate = [GRMustacheTemplate templateFromString:theTemplate error:&error];
// error is not nil here!!
NSArray array = [NSArray arrayWithObjects:@"str1", @"str2", @"str3", nil]; NSString arrayDataObjectName = @"array"; NSDictionary *templateVariables = [NSDictionary dictionaryWithObject:array forKey:arrayDataObjectName];
NSString *processedTemplate = [parsedTemplate renderObjectsInArray:[NSArray arrayWithObjects:templateVariables, nil] withFilters:filters];
OK. Your code looks legit.
I don't know which version of GRMustache you are using, but it is likely that it is an old version.
I advise you to update to the latest version, or to read the Guide/filters.md that ships with your version. It's likely that it tells that the {{%FILTERS}}
pragma tag should be prepended to the beginning of your templates.
Tell me if it works.
Yeah.. it works.. I didn't realized that I need to read documentation from the version I've downloaded and not the last one. Thanks for help!
You're welcome! I close the issue. Please reopen, or open a new one, if something else is wrong. Happy GRMustache!
On the versions between 5.4.4 and 4.3.0 any filter in template string generates error "Error Domain=GRMustacheErrorDomain Code=0 "Parse error at line 1: Invalid expression"" on processing attempt.
I need working GRMustache with filters and with armv6 support.
I've just built last version for armv6, but you need to figure what the problem is.