Skip to content

Commit

Permalink
v1.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
groue committed Feb 23, 2012
1 parent 5cabcef commit 92c07e2
Show file tree
Hide file tree
Showing 19 changed files with 526 additions and 218 deletions.
4 changes: 2 additions & 2 deletions Classes/GRMustacheVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
@since v1.0
*/
#define GRMUSTACHE_MINOR_VERSION 10
#define GRMUSTACHE_MINOR_VERSION 11

/**
The patch-level component of GRMustache version
@since v1.0
*/
#define GRMUSTACHE_PATCH_VERSION 3
#define GRMUSTACHE_PATCH_VERSION 0

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ You can render templates on the fly:

You can also parse a template once, and render it many times.

GRMustacheTemplate *template = [GRMustacheTemplate parseString:templateString error:NULL];
GRMustacheTemplate *template = [GRMustacheTemplate templateFromString:templateString error:NULL];
[template renderObject:arthur];
[template renderObject:...];

Expand Down
40 changes: 40 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,46 @@ GRMustache Release Notes

You can compare the performances of GRMustache version at https://github.com/groue/GRMustacheBenchmark.

## v1.11

**API cleanup**

New GRMustacheTemplateLoader methods:

- `- (GRMustacheTemplate *)templateWithName:(NSString *)name error:(NSError **)outError;`
- `- (GRMustacheTemplate *)templateFromString:(NSString *)templateString error:(NSError **)outError;`

New GRMustacheTemplate methods:

- `+ (id)templateFromString:(NSString *)templateString error:(NSError **)outError;`
- `+ (id)templateFromString:(NSString *)templateString options:(GRMustacheTemplateOptions)options error:(NSError **)outError;`
- `+ (id)templateFromContentsOfFile:(NSString *)path error:(NSError **)outError;`
- `+ (id)templateFromContentsOfFile:(NSString *)path options:(GRMustacheTemplateOptions)options error:(NSError **)outError;`
- `+ (id)templateFromResource:(NSString *)name bundle:(NSBundle *)bundle error:(NSError **)outError;`
- `+ (id)templateFromResource:(NSString *)name bundle:(NSBundle *)bundle options:(GRMustacheTemplateOptions)options error:(NSError **)outError;`
- `+ (id)templateFromResource:(NSString *)name withExtension:(NSString *)ext bundle:(NSBundle *)bundle error:(NSError **)outError;`
- `+ (id)templateFromResource:(NSString *)name withExtension:(NSString *)ext bundle:(NSBundle *)bundle options:(GRMustacheTemplateOptions)options error:(NSError **)outError;`
- `+ (id)templateFromContentsOfURL:(NSURL *)url error:(NSError **)outError;`
- `+ (id)templateFromContentsOfURL:(NSURL *)url options:(GRMustacheTemplateOptions)options error:(NSError **)outError;`

Deprecated GRMustacheTemplateLoader methods (use `templateWithName:error:` and `templateFromString:error:` instead):

- `- (GRMustacheTemplate *)parseTemplateNamed:(NSString *)name error:(NSError **)outError;`
- `- (GRMustacheTemplate *)parseString:(NSString *)templateString error:(NSError **)outError;`

Deprecated GRMustacheTemplate methods (replace `parse` with `templateFrom`):

- `+ (id)parseString:(NSString *)templateString error:(NSError **)outError;`
- `+ (id)parseString:(NSString *)templateString options:(GRMustacheTemplateOptions)options error:(NSError **)outError;`
- `+ (id)parseContentsOfFile:(NSString *)path error:(NSError **)outError;`
- `+ (id)parseContentsOfFile:(NSString *)path options:(GRMustacheTemplateOptions)options error:(NSError **)outError;`
- `+ (id)parseResource:(NSString *)name bundle:(NSBundle *)bundle error:(NSError **)outError;`
- `+ (id)parseResource:(NSString *)name bundle:(NSBundle *)bundle options:(GRMustacheTemplateOptions)options error:(NSError **)outError;`
- `+ (id)parseResource:(NSString *)name withExtension:(NSString *)ext bundle:(NSBundle *)bundle error:(NSError **)outError;`
- `+ (id)parseResource:(NSString *)name withExtension:(NSString *)ext bundle:(NSBundle *)bundle options:(GRMustacheTemplateOptions)options error:(NSError **)outError;`
- `+ (id)parseContentsOfURL:(NSURL *)url error:(NSError **)outError;`
- `+ (id)parseContentsOfURL:(NSURL *)url options:(GRMustacheTemplateOptions)options error:(NSError **)outError;`

## v1.10.3

Upgrade GRMustache, and get deprecation warnings when you use deprecated APIs. Your code will keep on running fine, though.
Expand Down
4 changes: 2 additions & 2 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
- Bring back categories. Read http://jverkoey.github.com/nimbus/group___preprocessor-_macros.html
- deprecate [XXX parseYYY] and introduce [XXX templateFromYYY]
- deprecate [GRMustacheTemplateLoader parseTemplateNamed:error:] and introduce [GRMustacheTemplateLoader parseTemplate:error:]
- support BOOL property getters `{{#isPretty}}`
- Handlebars: support `\{{foo}}` escaped tag
- Handlebars: support `{{#section value}}...{{/section}}`
Expand All @@ -19,3 +17,5 @@
- provide a way to return an explicit HTML-safe string from a helper
- provide a way to return an explicit HTML-unsafe string from a helper
+ deprecate full GRMustacheContext class
+ deprecate [XXX parseYYY] and introduce [XXX templateFromYYY]
+ deprecate [GRMustacheTemplateLoader parseTemplateNamed:error:] and introduce [GRMustacheTemplateLoader templateWithName:error:]
2 changes: 1 addition & 1 deletion guides/runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Generally speaking, GRMustache will look for values in your data objects through
You can thus provide rendering methods with NSDictionary instances, or custom objects with properties or methods whose name match the keys in the template tags.

// This template waits for a `name` key:
GRMustacheTemplate *template = [GRMustacheTemplate parseString:@"{{name}}" error:NULL];
GRMustacheTemplate *template = [GRMustacheTemplate templateFromString:@"{{name}}" error:NULL];

// Those two objects provide this `name` key:
NSDictionary *dictionary = [NSDictionary dictionaryWithObject:@"dictionary" forKey:@"name"];
Expand Down
4 changes: 2 additions & 2 deletions guides/runtime/booleans.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ We'll first talk about some simple cases. We'll then discuss caveats.
The simplest way to provide booleans to GRMustache is to provide objects returned by the `[NSNumber numberWithBool:]` method:

NSString *templateString = @"{{#pretty}}whistle{{/pretty}}";
GRMustacheTemplate *template = [GRMustacheTemplate parseString:templateString error:NULL];
GRMustacheTemplate *template = [GRMustacheTemplate templateFromString:templateString error:NULL];

// @"whistle"
[template renderObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES]
Expand Down Expand Up @@ -106,7 +106,7 @@ For the very same reason, you should not use your property getters in templates:

// Note the use of the property getter, this time
NSString *templateString = @"{{#isPretty}}whistle{{/isPretty}}";
GRMustacheTemplate *template = [GRMustacheTemplate parseString:templateString error:NULL];
GRMustacheTemplate *template = [GRMustacheTemplate templateFromString:templateString error:NULL];

// @"whistle"
[template renderObject:dave];
Expand Down
8 changes: 4 additions & 4 deletions guides/template_loaders.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ For instance:

You may now load a template from its location:

GRMustacheTemplate *template = [loader parseTemplateNamed:@"document" error:NULL];
GRMustacheTemplate *template = [loader templateWithName:@"document" error:NULL];

You may also have the loader parse a template string. Only partials would then be loaded from the loader's location:

GRMustacheTemplate *template = [loader parseString:@"..." error:NULL];
GRMustacheTemplate *template = [loader templateFromString:@"..." error:NULL];

The rendering is done as usual:

Expand Down Expand Up @@ -128,8 +128,8 @@ Now we may instanciate one:

Then load templates from it:

GRMustacheTemplate *template1 = [loader parseString:@"{{>partial}}" error:NULL];
GRMustacheTemplate *template2 = [loader parseTemplateNamed:@"partial" error:NULL];
GRMustacheTemplate *template1 = [loader templateFromString:@"{{>partial}}" error:NULL];
GRMustacheTemplate *template2 = [loader templateWithTemplateName:@"partial" error:NULL];

And finally render:

Expand Down
36 changes: 18 additions & 18 deletions guides/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,27 @@ It's efficient to parse a template once, and then render it as often as needed:
@interface GRMustacheTemplate

// Parses the templateString.
+ (id)parseString:(NSString *)templateString
error:(NSError **)outError;
+ (id)templateFromString:(NSString *)templateString
error:(NSError **)outError;

// Loads and parses the template from url. (from MacOS 10.6 and iOS 4.0)
+ (id)parseContentsOfURL:(NSURL *)url
error:(NSError **)outError;
+ (id)templateFromContentsOfURL:(NSURL *)url
error:(NSError **)outError;

// Loads and parses the template from path.
+ (id)parseContentsOfFile:(NSString *)path
error:(NSError **)outError;
+ (id)templateFromContentsOfFile:(NSString *)path
error:(NSError **)outError;

// Loads and parses the template from a bundle resource of extension "mustache".
+ (id)parseResource:(NSString *)name
bundle:(NSBundle *)bundle // nil stands for the main bundle
error:(NSError **)outError;
+ (id)templateFromResource:(NSString *)name
bundle:(NSBundle *)bundle // nil stands for the main bundle
error:(NSError **)outError;

// Loads and parses the template from a bundle resource of provided extension.
+ (id)parseResource:(NSString *)name
withExtension:(NSString *)ext
bundle:(NSBundle *)bundle // nil stands for the main bundle
error:(NSError **)outError;
+ (id)templateFromResource:(NSString *)name
withExtension:(NSString *)ext
bundle:(NSBundle *)bundle // nil stands for the main bundle
error:(NSError **)outError;

Those methods return GRMustacheTemplate instances, which render objects with the following methods:

Expand All @@ -101,19 +101,19 @@ Depending on the method which has been used to create the original template, par

- In the main bundle, with ".mustache" extension:
- `renderObject:fromString:error:`
- `parseString:error:`
- `templateFromString:error:`
- In the specified bundle, with ".mustache" extension:
- `renderObject:fromResource:bundle:error:`
- `parseResource:bundle:error:`
- `templateFromResource:bundle:error:`
- In the specified bundle, with the provided extension:
- `renderObject:fromResource:withExtension:bundle:error:`
- `parseResource:withExtension:bundle:error:`
- `templateFromResource:withExtension:bundle:error:`
- Relatively to the URL of the including template, with the same extension:
- `renderObject:fromContentsOfURL:error:`
- `parseContentsOfURL:error:`
- `templateFromContentsOfURL:error:`
- Relatively to the path of the including template, with the same extension:
- `renderObject:fromContentsOfFile:error:`
- `parseContentsOfFile:error:`
- `templateFromContentsOfFile:error:`

You can write recursive partials. Just avoid infinite loops in your context objects.

Expand Down
5 changes: 3 additions & 2 deletions include/GRBoolean.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
@see GRMustache#strictBooleanMode
@see GRNo
@since v1.0
@deprecated v1.2
*/
@interface GRYes : NSObject <NSCopying>
DEPRECATED_IN_GRMUSTACHE_VERSION_1_2_AND_LATER @interface GRYes : NSObject <NSCopying>
/**
@deprecated Use `[NSNumber numberWithBool:YES]` instead.
@return the GRYes singleton.
Expand Down Expand Up @@ -64,7 +65,7 @@
@see GRYes
@since v1.0
*/
@interface GRNo : NSObject <NSCopying>
DEPRECATED_IN_GRMUSTACHE_VERSION_1_2_AND_LATER @interface GRNo : NSObject <NSCopying>
/**
@deprecated Use `[NSNumber numberWithBool:NO]` instead.
@return the GRNo singleton.
Expand Down
2 changes: 1 addition & 1 deletion include/GRMustache.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ typedef struct {
/**
Sets the default template options.
Those options will be used by all GRMustacheTemplate rendering and parsing methods, such as [GRMustacheTemplate parseString:error:] and [GRMustacheTemplate renderObject:fromString:error:].
Those options will be used by all GRMustacheTemplate rendering and parsing methods, such as [GRMustacheTemplate templateFromString:error:] and [GRMustacheTemplate renderObject:fromString:error:].
For instance, you'll trigger support for the [Mustache Specification 1.1.2](https://github.com/mustache/spec) with:
Expand Down
Loading

0 comments on commit 92c07e2

Please sign in to comment.