diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index ec003b1d..c411a4c9 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -73,16 +73,27 @@ GRMustacheTemplate and GRMustacheConfiguration have methods for inserting priori ```objc @interface GRMustacheContext -+ (instancetype)contextWithProtectedObject:(id)object; // use contextWithPriorityObject instead -- (instancetype)contextByAddingProtectedObject:(id)object; // use contextByAddingPriorityObject instead + +// use contextWithPriorityObject instead ++ (instancetype)contextWithProtectedObject:(id)object; + +// use contextByAddingPriorityObject instead +- (instancetype)contextByAddingProtectedObject:(id)object; + @end @interface GRMustacheTemplate -- (void)extendBaseContextWithProtectedObject:(id)object; // use extendBaseContextWithPriorityObject instead + +// use extendBaseContextWithPriorityObject instead +- (void)extendBaseContextWithProtectedObject:(id)object; + @end @interface GRMustacheConfiguration -- (void)extendBaseContextWithProtectedObject:(id)object; // use extendBaseContextWithPriorityObject instead + +// Use extendBaseContextWithPriorityObject instead +- (void)extendBaseContextWithProtectedObject:(id)object; + @end ``` @@ -117,7 +128,10 @@ GRMustache implementation of inheritable templates is now closer from [hogan.js] ```objc typedef NS_ENUM(NSUInteger, GRMustacheTagType) { - GRMustacheTagTypeOverridableSection; // constant not replaced + + // This constant is not replaced. + GRMustacheTagTypeOverridableSection, + } ``` @@ -130,19 +144,59 @@ typedef NS_ENUM(NSUInteger, GRMustacheTagType) { ```objc @interface GRMustache + + (GRMustacheVersion)libraryVersion; + +@end + +@interface GRMustacheRendering + ++ (id)renderingObjectForObject:(id)object; ++ (id)renderingObjectWithBlock:(NSString *(^)(GRMustacheTag *tag, GRMustacheContext *context, BOOL *HTMLSafe, NSError **error))block; + @end ``` -**Removed APIS** +**Deprecated APIs** ```objc @interface GRMustache -+ (GRMustacheVersion)version; // Use libraryVersion instead. + +// Use `+[GRMustacheRendering renderingObjectForObject:]` instead. ++ (id)renderingObjectForObject:(id)object; + + // Use `+[GRMustacheRendering renderingObjectWithBlock:]` instead. ++ (id)renderingObjectWithBlock:(NSString *(^)(GRMustacheTag *tag, GRMustacheContext *context, BOOL *HTMLSafe, NSError **error))block; + +@end + +@interface GRMustacheTag + +// Replace `[tag.templateRepository templateFromString:... error:...]` by +// `[GRMustacheTemplate templateFromString:... error:...]`. +// +// Replace `[tag.templateRepository templateNamed:... error:...]` by explicit +// invocation of the targeted template repository. +@property (nonatomic, readonly) GRMustacheTemplateRepository *templateRepository; + +@end +``` + +**Removed APIs** + +```objc +@interface GRMustache + +// Use +[GRMustache libraryVersion] instead. ++ (GRMustacheVersion)version; + @end @interface GRMustacheContext -- (id)valueForMustacheExpression:(NSString *)string error:(NSError **)error; // This method used to be deprecated. Use hasValue:forMustacheExpression:error: instead. + +// Use -[GRMustacheContext hasValue:forMustacheExpression:error:] instead. +- (id)valueForMustacheExpression:(NSString *)string error:(NSError **)error; + @end ``` diff --git a/TODO.md b/TODO.md index e5f255fb..4d6e3da1 100644 --- a/TODO.md +++ b/TODO.md @@ -1,7 +1,6 @@ ## TODO -- [ ] document dropped support for GRMustacheTag.templateRepository -- [X] have [GRMustacheTemplate templateFromString:error:] use current repository & content type, and remove public GRMustacheTag.templateRepository +- [X] have [GRMustacheTemplate templateFromString:error:] use current repository & content type, and deprecate GRMustacheTag.templateRepository - [?] have GRMustacheTemplateRepository cache template from string (for faster rendering objects) - [X] expose GRMustacheTemplate.templateRepository - [X] document dropped support for garbage collection diff --git a/src/classes/GRMustacheTag.h b/src/classes/GRMustacheTag.h index 8e3b0384..626a7825 100644 --- a/src/classes/GRMustacheTag.h +++ b/src/classes/GRMustacheTag.h @@ -24,6 +24,8 @@ #import "GRMustacheAvailabilityMacros.h" #import "GRMustacheConfiguration.h" +@class GRMustacheTemplateRepository; + /** * The types of Mustache tags * @@ -103,6 +105,20 @@ typedef NS_ENUM(NSUInteger, GRMustacheTagType) { /// @name Methods Dedicated to the GRMustacheRendering Protocol //////////////////////////////////////////////////////////////////////////////// +/** + * This method is deprecated. + * + * Replace `[tag.templateRepository templateFromString:... error:...]` by + * `[GRMustacheTemplate templateFromString:... error:...]`. + * + * Replace `[tag.templateRepository templateNamed:... error:...]` by explicit + * invocation of the targeted template repository. + * + * @since v6.0 + * @deprecated v7.0 + */ +@property (nonatomic, readonly) GRMustacheTemplateRepository *templateRepository AVAILABLE_GRMUSTACHE_VERSION_7_0_AND_LATER_BUT_DEPRECATED; + /** * Returns the rendering of the tag's inner content, rendering all inner * Mustache tags with the rendering context argument. diff --git a/src/classes/GRMustacheTag.m b/src/classes/GRMustacheTag.m index e35c3dc5..0ed173cf 100644 --- a/src/classes/GRMustacheTag.m +++ b/src/classes/GRMustacheTag.m @@ -95,6 +95,11 @@ - (NSString *)renderContentWithContext:(GRMustacheContext *)context HTMLSafe:(BO return @""; } +- (GRMustacheTemplateRepository *)templateRepository +{ + return [GRMustacheRendering currentTemplateRepository]; +} + #pragma mark - diff --git a/src/classes/GRMustacheTag_private.h b/src/classes/GRMustacheTag_private.h index 0417ee50..1e0d4177 100644 --- a/src/classes/GRMustacheTag_private.h +++ b/src/classes/GRMustacheTag_private.h @@ -27,6 +27,7 @@ @class GRMustacheExpression; @class GRMustacheContext; +@class GRMustacheTemplateRepository; // Documented in GRMustacheTag.h typedef NS_ENUM(NSUInteger, GRMustacheTagType) { @@ -50,6 +51,9 @@ typedef NS_ENUM(NSUInteger, GRMustacheTagType) { // Documented in GRMustacheTag.h @property (nonatomic, readonly) NSString *innerTemplateString GRMUSTACHE_API_PUBLIC; +// Documented in GRMustacheTag.h +@property (nonatomic, readonly) GRMustacheTemplateRepository *templateRepository GRMUSTACHE_API_PUBLIC_BUT_DEPRECATED; + /** * Returns the content type of the receiver. *