Permalink
Browse files

[ISSUE-439] Update GRMustache to 7.0.2

  • Loading branch information...
1 parent f7ad920 commit fca4def4eae849690f59afff9df3142d388734d6 Stephen Tramer committed with sptramer Jul 10, 2014
Showing with 5,579 additions and 3,202 deletions.
  1. +0 −122 Common/ThirdParty/GRMustache/GRBoolean.m
  2. +138 −39 Common/ThirdParty/GRMustache/GRMustache.h
  3. +0 −55 Common/ThirdParty/GRMustache/GRMustache.m
  4. +93 −0 Common/ThirdParty/GRMustache/GRMustacheAvailabilityMacros.h
  5. +0 −47 Common/ThirdParty/GRMustache/GRMustacheBundleTemplateLoader.m
  6. +0 −31 Common/ThirdParty/GRMustache/GRMustacheBundleTemplateLoader_private.h
  7. +0 −170 Common/ThirdParty/GRMustache/GRMustacheCompiler.m
  8. +295 −0 Common/ThirdParty/GRMustache/GRMustacheConfiguration.h
  9. +33 −21 Common/ThirdParty/GRMustache/{GRMustacheCompiler_private.h → GRMustacheContentType.h}
  10. +482 −0 Common/ThirdParty/GRMustache/GRMustacheContext.h
  11. +0 −226 Common/ThirdParty/GRMustache/GRMustacheContext.m
  12. +0 −32 Common/ThirdParty/GRMustache/GRMustacheContext_private.h
  13. +0 −67 Common/ThirdParty/GRMustache/GRMustacheDirectoryTemplateLoader.m
  14. +0 −32 Common/ThirdParty/GRMustache/GRMustacheDirectoryTemplateLoader_private.h
  15. +43 −35 Common/ThirdParty/GRMustache/GRMustacheError.h
  16. +0 −27 Common/ThirdParty/GRMustache/GRMustacheError.m
  17. +125 −0 Common/ThirdParty/GRMustache/GRMustacheFilter.h
  18. +0 −67 Common/ThirdParty/GRMustache/GRMustacheLambda.m
  19. +0 −31 Common/ThirdParty/GRMustache/GRMustacheLambda_private.h
  20. +107 −0 Common/ThirdParty/GRMustache/GRMustacheLocalizer.h
  21. +129 −0 Common/ThirdParty/GRMustache/GRMustacheRendering.h
  22. +32 −12 Common/ThirdParty/GRMustache/{GRMustacheTextElement_private.h → GRMustacheSafeKeyAccess.h}
  23. +0 −151 Common/ThirdParty/GRMustache/GRMustacheSectionElement.m
  24. +0 −35 Common/ThirdParty/GRMustache/GRMustacheSectionElement_private.h
  25. +153 −0 Common/ThirdParty/GRMustache/GRMustacheTag.h
  26. +84 −0 Common/ThirdParty/GRMustache/GRMustacheTagDelegate.h
  27. +322 −138 Common/ThirdParty/GRMustache/GRMustacheTemplate.h
  28. +0 −178 Common/ThirdParty/GRMustache/GRMustacheTemplate.m
  29. +0 −147 Common/ThirdParty/GRMustache/GRMustacheTemplateLoader.h
  30. +0 −168 Common/ThirdParty/GRMustache/GRMustacheTemplateLoader.m
  31. +0 −30 Common/ThirdParty/GRMustache/GRMustacheTemplateLoader_private.h
  32. +0 −119 Common/ThirdParty/GRMustache/GRMustacheTemplateLoader_protected.h
  33. +577 −0 Common/ThirdParty/GRMustache/GRMustacheTemplateRepository.h
  34. +0 −32 Common/ThirdParty/GRMustache/GRMustacheTemplate_private.h
  35. +0 −56 Common/ThirdParty/GRMustache/GRMustacheTextElement.m
  36. +0 −57 Common/ThirdParty/GRMustache/GRMustacheToken.m
  37. +0 −63 Common/ThirdParty/GRMustache/GRMustacheToken_private.h
  38. +0 −333 Common/ThirdParty/GRMustache/GRMustacheTokenizer.m
  39. +0 −33 Common/ThirdParty/GRMustache/GRMustacheTokenizer_private.h
  40. +0 −35 Common/ThirdParty/GRMustache/GRMustacheURLTemplateLoader.m
  41. +0 −27 Common/ThirdParty/GRMustache/GRMustacheURLTemplateLoader_private.h
  42. +0 −80 Common/ThirdParty/GRMustache/GRMustacheVariableElement.m
  43. +0 −32 Common/ThirdParty/GRMustache/GRMustacheVariableElement_private.h
  44. +13 −45 Common/ThirdParty/GRMustache/GRMustacheVersion.h
  45. +0 −34 Common/ThirdParty/GRMustache/GRMustacheVersion.m
  46. +0 −37 Common/ThirdParty/GRMustache/GRMustache_private.h
  47. +70 −0 Common/ThirdParty/GRMustache/NSFormatter+GRMustache.h
  48. +12 −12 Common/ThirdParty/GRMustache/{GRMustacheElement.h → NSValueTransformer+GRMustache.h}
  49. +0 −38 Generating/GBDictionaryTemplateLoader.h
  50. +0 −41 Generating/GBDictionaryTemplateLoader.m
  51. +1 −1 Generating/GBDocSetOutputGenerator.m
  52. +1 −1 Generating/GBHTMLTemplateVariablesProvider.m
  53. +23 −6 Generating/GBTemplateHandler.m
  54. +174 −0 Libraries/GRMustache/GRMustache.h
  55. +93 −0 Libraries/GRMustache/GRMustacheAvailabilityMacros.h
  56. +295 −0 Libraries/GRMustache/GRMustacheConfiguration.h
  57. +33 −10 Common/ThirdParty/GRMustache/GRMustacheLambda.h → Libraries/GRMustache/GRMustacheContentType.h
  58. +482 −0 Libraries/GRMustache/GRMustacheContext.h
  59. +42 −48 Common/ThirdParty/GRMustache/GRBoolean.h → Libraries/GRMustache/GRMustacheError.h
  60. +125 −0 Libraries/GRMustache/GRMustacheFilter.h
  61. +107 −0 Libraries/GRMustache/GRMustacheLocalizer.h
  62. +129 −0 Libraries/GRMustache/GRMustacheRendering.h
  63. +54 −0 Libraries/GRMustache/GRMustacheSafeKeyAccess.h
  64. +153 −0 Libraries/GRMustache/GRMustacheTag.h
  65. +84 −0 Libraries/GRMustache/GRMustacheTagDelegate.h
  66. +382 −0 Libraries/GRMustache/GRMustacheTemplate.h
  67. +577 −0 Libraries/GRMustache/GRMustacheTemplateRepository.h
  68. +19 −9 Common/ThirdParty/GRMustache/GRMustacheElement.m → Libraries/GRMustache/GRMustacheVersion.h
  69. +70 −0 Libraries/GRMustache/NSFormatter+GRMustache.h
  70. +14 −11 ...rty/GRMustache/GRMustacheElement_private.h → Libraries/GRMustache/NSValueTransformer+GRMustache.h
  71. BIN Libraries/libGRMustache7-MacOS.a
  72. +1 −1 Model/GBMethodData.m
  73. +1 −1 Testing/GBObjectsAssertor.m
  74. +1 −1 Testing/GBTemplateHandlerTesting.m
  75. +10 −178 appledoc.xcodeproj/project.pbxproj
@@ -1,122 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRBoolean.h"
-
-
-static GRYes *yes = nil;
-
-@implementation GRYes
-
-+ (GRYes *)yes {
- if (yes == nil) {
- yes = [[super allocWithZone:NULL] init];
- }
- return yes;
-}
-
-+ (id)allocWithZone:(NSZone *)zone {
- return [[self yes] retain];
-}
-
-- (id)copyWithZone:(NSZone *)zone {
- return self;
-}
-
-- (id)retain {
- return self;
-}
-
-- (NSUInteger)retainCount {
- return NSUIntegerMax; //denotes an object that cannot be released
-}
-
-- (oneway void)release {
- //do nothing
-}
-
-- (id)autorelease {
- return self;
-}
-
-- (id)valueForKey:(NSString *)key {
- return nil;
-}
-
-- (BOOL)boolValue {
- return YES;
-}
-
-- (NSString *)description {
- return @"(yes)";
-}
-
-@end
-
-static GRNo *no = nil;
-
-@implementation GRNo
-
-+ (GRNo *)no {
- if (no == nil) {
- no = [[super allocWithZone:NULL] init];
- }
- return no;
-}
-
-+ (id)allocWithZone:(NSZone *)zone {
- return [[self no] retain];
-}
-
-- (id)copyWithZone:(NSZone *)zone {
- return self;
-}
-
-- (id)retain {
- return self;
-}
-
-- (NSUInteger)retainCount {
- return NSUIntegerMax; //denotes an object that cannot be released
-}
-
-- (oneway void)release {
- //do nothing
-}
-
-- (id)autorelease {
- return self;
-}
-
-- (id)valueForKey:(NSString *)key {
- return nil;
-}
-
-- (BOOL)boolValue {
- return NO;
-}
-
-- (NSString *)description {
- return @"(no)";
-}
-
-@end
@@ -1,6 +1,6 @@
// The MIT License
//
-// Copyright (c) 2010 Gwendal Roué
+// Copyright (c) 2014 Gwendal Roué
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -21,55 +21,154 @@
// THE SOFTWARE.
#import <Foundation/Foundation.h>
+#import "GRMustacheAvailabilityMacros.h"
+
+@protocol GRMustacheRendering;
+@class GRMustacheTag;
+@class GRMustacheContext;
/**
- The GRMustache class provides with global-level information and configuration
- of the GRMustache library.
- @since v1.0.0
+ * A C struct that hold GRMustache version information
+ *
+ * @since v1.0
+ */
+typedef struct {
+ int major; /**< The major component of the version. */
+ int minor; /**< The minor component of the version. */
+ int patch; /**< The patch-level component of the version. */
+} GRMustacheVersion;
+
+
+/**
+ * The GRMustache class provides with global-level information and configuration
+ * of the GRMustache library.
+ *
+ * @since v1.0
*/
@interface GRMustache: NSObject
-//////////////////////////////////////////////////////////////////////////////////////////
-/// @name Handling of boolean properties
-//////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+/// @name Getting the GRMustache version
+////////////////////////////////////////////////////////////////////////////////
/**
- A Boolean value that determines whether GRMustache renders templates in strict
- boolean mode.
-
- @returns YES if GRMustache renders templates in strict boolean mode,
- NO otherwise. The default value is NO.
-
- In strict boolean mode, properties of context objects that are declared as BOOL
- are interpreted as numbers, and can not be used for controlling Mustache
- boolean sections.
-
- In non-strict boolean mode, all properties declared as signed char (including
- those declared as BOOL), are interpreted as booleans, and can be used for
- controlling Mustache boolean sections.
-
- @see GRMustache#setStrictBooleanMode:
- @see GRYes
- @see GRNo
- @since v1.0.0
+ * @return The version of GRMustache as a GRMustacheVersion struct.
+ *
+ * @since v7.0
*/
-+ (BOOL)strictBooleanMode;
++ (GRMustacheVersion)libraryVersion AVAILABLE_GRMUSTACHE_VERSION_7_0_AND_LATER;
+
+
+////////////////////////////////////////////////////////////////////////////////
+/// @name Preventing NSUndefinedKeyException in Development configuration
+////////////////////////////////////////////////////////////////////////////////
/**
- Sets the strict boolean mode of GMustache.
-
- @param aBool YES if GRMustache should render templates in strict boolean mode,
- NO otherwise.
-
- @see GRMustache#strictBooleanMode
- @since v1.0.0
+ * Have GRMustache avoid most `NSUndefinedKeyExceptions` when rendering
+ * templates.
+ *
+ * The rendering of a GRMustache template can lead to `NSUndefinedKeyExceptions`
+ * to be raised, because of the usage of the `valueForKey:` method. Those
+ * exceptions are nicely handled by GRMustache, and are part of the regular
+ * rendering of a template.
+ *
+ * Unfortunately, Objective-C exceptions have several drawbacks, particularly:
+ *
+ * 1. they play badly with autorelease pools, and are reputed to leak memory.
+ * 2. they usually stop your debugger when you are developping your application.
+ *
+ * The first point is indeed a matter of worry: Apple does not guarantee that
+ * exceptions raised by `valueForKey:` do not leak memory. However, I never had
+ * any evidence of such a leak from NSObject's implementation.
+ *
+ * Should you still worry, we recommend that you avoid the `valueForKey:` method
+ * altogether. Instead, implement the [keyed subscripting](http://clang.llvm.org/docs/ObjectiveCLiterals.html#dictionary-style-subscripting)
+ * `objectForKeyedSubscript:` method on objects that you provide to GRMustache.
+ *
+ * The second point is valid also: NSUndefinedKeyException raised by template
+ * rendering may become a real annoyance when you are debugging your project,
+ * because it's likely you've told your debugger to stop on every Objective-C
+ * exceptions.
+ *
+ * You can avoid them as well: make sure you invoke once, early in your
+ * application, the `preventNSUndefinedKeyExceptionAttack` method.
+ *
+ * Depending on the number of NSUndefinedKeyException that get prevented, you
+ * will experience a slight performance hit, or a performance improvement.
+ *
+ * Since the main use case for this method is to avoid Xcode breaks on rendering
+ * exceptions, the best practice is to conditionally invoke this method, using
+ * the [NS_BLOCK_ASSERTIONS](http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html)
+ * that helps identifying the Debug configuration of your targets:
+ *
+ * ```
+ * #if !defined(NS_BLOCK_ASSERTIONS)
+ * // Debug configuration: keep GRMustache quiet
+ * [GRMustache preventNSUndefinedKeyExceptionAttack];
+ * #endif
+ * ```
+ *
+ * **Companion guide:** https://github.com/groue/GRMustache/blob/master/Guides/runtime.md
+ *
+ * @since v1.7
*/
-+ (void)setStrictBooleanMode:(BOOL)aBool;
++ (void)preventNSUndefinedKeyExceptionAttack AVAILABLE_GRMUSTACHE_VERSION_7_0_AND_LATER;
+
+
+////////////////////////////////////////////////////////////////////////////////
+/// @name Standard Library
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @return The GRMustache standard library.
+ *
+ * **Companion guide:** https://github.com/groue/GRMustache/blob/master/Guides/standard_library.md
+ *
+ * @since v6.4
+ */
++ (NSObject *)standardLibrary AVAILABLE_GRMUSTACHE_VERSION_7_0_AND_LATER;
+
+
+////////////////////////////////////////////////////////////////////////////////
+/// @name Building rendering objects
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * This method is deprecated. Use
+ * `+[GRMustacheRendering renderingObjectForObject:]` instead.
+ *
+ * @see GRMustacheRendering class
+ *
+ * @since v6.0
+ * @deprecated v7.0
+ */
++ (id<GRMustacheRendering>)renderingObjectForObject:(id)object AVAILABLE_GRMUSTACHE_VERSION_7_0_AND_LATER_BUT_DEPRECATED;
+
+/**
+ * This method is deprecated. Use
+ * `+[GRMustacheRendering renderingObjectWithBlock:]` instead.
+ *
+ * @see GRMustacheRendering class
+ *
+ * @since v6.0
+ * @deprecated v7.0
+ */
++ (id<GRMustacheRendering>)renderingObjectWithBlock:(NSString *(^)(GRMustacheTag *tag, GRMustacheContext *context, BOOL *HTMLSafe, NSError **error))block AVAILABLE_GRMUSTACHE_VERSION_7_0_AND_LATER_BUT_DEPRECATED;
+
@end
-#import "GRMustacheVersion.h"
-#import "GRBoolean.h"
-#import "GRMustacheError.h"
-#import "GRMustacheLambda.h"
-#import "GRMustacheTemplateLoader.h"
#import "GRMustacheTemplate.h"
+#import "GRMustacheTagDelegate.h"
+#import "GRMustacheTemplateRepository.h"
+#import "GRMustacheFilter.h"
+#import "GRMustacheError.h"
+#import "GRMustacheVersion.h"
+#import "GRMustacheContentType.h"
+#import "GRMustacheContext.h"
+#import "GRMustacheRendering.h"
+#import "GRMustacheTag.h"
+#import "GRMustacheConfiguration.h"
+#import "GRMustacheLocalizer.h"
+#import "GRMustacheSafeKeyAccess.h"
+#import "NSValueTransformer+GRMustache.h"
+#import "NSFormatter+GRMustache.h"
@@ -1,55 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustache_private.h"
-#import "GRMustacheLambda_private.h"
-
-
-static BOOL strictBooleanMode = NO;
-
-@implementation GRMustache
-
-+ (BOOL)strictBooleanMode {
- return strictBooleanMode;
-}
-
-+ (void)setStrictBooleanMode:(BOOL)aBool {
- strictBooleanMode = aBool;
-}
-
-+ (GRMustacheObjectKind)objectKind:(id)object {
- if (object == nil || object == [NSNull null] || object == [GRNo no] || ([object isKindOfClass:[NSString class]] && ((NSString*)object).length == 0)) {
- return GRMustacheObjectKindFalseValue;
- }
- if ([object isKindOfClass:[NSDictionary class]]) {
- return GRMustacheObjectKindTrueValue;
- }
- if ([object conformsToProtocol:@protocol(NSFastEnumeration)]) {
- return GRMustacheObjectKindEnumerable;
- }
- if ([object isKindOfClass:[GRMustacheLambdaBlockWrapper class]]) {
- return GRMustacheObjectKindLambda;
- }
- return GRMustacheObjectKindTrueValue;
-}
-
-@end
Oops, something went wrong.

0 comments on commit fca4def

Please sign in to comment.