forked from Codeux-Software/Textual
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Very rough implementation of a new template engine for themes. Requires optimization and is not complete. Only supports main log line rendering. Inline media, links, and other stuff do not work yet. Use at your own risk.
- Loading branch information
emsquared
committed
Jul 25, 2012
1 parent
a0b0049
commit d987731
Showing
164 changed files
with
3,913 additions
and
776 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// The MIT License | ||
// | ||
// Copyright (c) 2012 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 "TextualApplication.h" | ||
|
||
/** | ||
* 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 Getting the GRMustache version | ||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
/** | ||
* @return The version of GRMustache as a GRMustacheVersion struct. | ||
* | ||
* @since v1.0 | ||
*/ | ||
+ (GRMustacheVersion)version AVAILABLE_GRMUSTACHE_VERSION_4_0_AND_LATER; | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
/// @name Preventing NSUndefinedKeyException when using GRMustache in Development configuration | ||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
/** | ||
* Have GRMustache avoid most `NSUndefinedKeyExceptions` when rendering | ||
* templates. | ||
* | ||
* The rendering of a GRMustache template can lead to many | ||
* `NSUndefinedKeyExceptions` to be raised, because of the heavy usage of | ||
* Key-Value Coding. Those exceptions are nicely handled by GRMustache, and are | ||
* part of the regular rendering of a template. | ||
* | ||
* Unfortunately, when debugging a project, developers usually set their | ||
* debugger to stop on every Objective-C exceptions. GRMustache rendering can | ||
* thus become a huge annoyance. This method prevents it. | ||
* | ||
* You'll get a slight performance hit, so you'd probably make sure this call | ||
* does not enter your Release configuration. | ||
* | ||
* One way to achieve this is to add `-DDEBUG` to the "Other C Flags" setting of | ||
* your development configuration, and to wrap the | ||
* `preventNSUndefinedKeyExceptionAttack` method call in a #if block, like: | ||
* | ||
* #ifdef DEBUG | ||
* [GRMustache preventNSUndefinedKeyExceptionAttack]; | ||
* #endif | ||
* | ||
* **Companion guide:** https://github.com/groue/GRMustache/blob/master/Guides/runtime/context_stack.md | ||
* | ||
* @since v1.7 | ||
*/ | ||
+ (void)preventNSUndefinedKeyExceptionAttack AVAILABLE_GRMUSTACHE_VERSION_4_0_AND_LATER; | ||
|
||
@end |
146 changes: 146 additions & 0 deletions
146
Classes/Headers/External Libraries/GRMustacheAvailabilityMacros.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
// The MIT License | ||
// | ||
// Copyright (c) 2012 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 "TextualApplication.h" | ||
|
||
|
||
|
||
/* | ||
* Set up standard GRMustache versions | ||
*/ | ||
#define GRMUSTACHE_VERSION_4_0 4000 | ||
#define GRMUSTACHE_VERSION_4_1 4010 | ||
|
||
|
||
|
||
|
||
|
||
|
||
/* | ||
* If max GRMustacheVersion not specified, assume 4.1 | ||
*/ | ||
#ifndef GRMUSTACHE_VERSION_MAX_ALLOWED | ||
#define GRMUSTACHE_VERSION_MAX_ALLOWED GRMUSTACHE_VERSION_4_1 | ||
#endif | ||
|
||
/* | ||
* if min GRMustacheVersion not specified, assume max | ||
*/ | ||
#ifndef GRMUSTACHE_VERSION_MIN_REQUIRED | ||
#define GRMUSTACHE_VERSION_MIN_REQUIRED GRMUSTACHE_VERSION_MAX_ALLOWED | ||
#endif | ||
|
||
/* | ||
* Error on bad values | ||
*/ | ||
#if GRMUSTACHE_VERSION_MAX_ALLOWED < GRMUSTACHE_VERSION_MIN_REQUIRED | ||
#error GRMUSTACHE_VERSION_MAX_ALLOWED must be >= GRMUSTACHE_VERSION_MIN_REQUIRED | ||
#endif | ||
#if GRMUSTACHE_VERSION_MIN_REQUIRED < GRMUSTACHE_VERSION_4_0 | ||
#error GRMUSTACHE_VERSION_MIN_REQUIRED must be >= GRMUSTACHE_VERSION_4_0 | ||
#endif | ||
|
||
|
||
|
||
|
||
|
||
|
||
/* | ||
* AVAILABLE_GRMUSTACHE_VERSION_4_0_AND_LATER | ||
* | ||
* Used on declarations introduced in GRMustache 4.0 | ||
*/ | ||
#define AVAILABLE_GRMUSTACHE_VERSION_4_0_AND_LATER | ||
|
||
/* | ||
* AVAILABLE_GRMUSTACHE_VERSION_4_0_AND_LATER_BUT_DEPRECATED | ||
* | ||
* Used on declarations introduced in GRMustache 4.0, | ||
* and deprecated in GRMustache 4.0 | ||
*/ | ||
#define AVAILABLE_GRMUSTACHE_VERSION_4_0_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE | ||
|
||
/* | ||
* DEPRECATED_IN_GRMUSTACHE_VERSION_4_0_AND_LATER | ||
* | ||
* Used on types deprecated in GRMustache 4.0 | ||
*/ | ||
#define DEPRECATED_IN_GRMUSTACHE_VERSION_4_0_AND_LATER DEPRECATED_ATTRIBUTE | ||
|
||
|
||
|
||
|
||
|
||
|
||
/* | ||
* AVAILABLE_GRMUSTACHE_VERSION_4_1_AND_LATER | ||
* | ||
* Used on declarations introduced in GRMustache 4.1 | ||
*/ | ||
#if GRMUSTACHE_VERSION_MAX_ALLOWED < GRMUSTACHE_VERSION_4_1 | ||
#define AVAILABLE_GRMUSTACHE_VERSION_4_1_AND_LATER UNAVAILABLE_ATTRIBUTE | ||
#elif GRMUSTACHE_VERSION_MIN_REQUIRED < GRMUSTACHE_VERSION_4_1 | ||
#define AVAILABLE_GRMUSTACHE_VERSION_4_1_AND_LATER WEAK_IMPORT_ATTRIBUTE | ||
#else | ||
#define AVAILABLE_GRMUSTACHE_VERSION_4_1_AND_LATER | ||
#endif | ||
|
||
/* | ||
* AVAILABLE_GRMUSTACHE_VERSION_4_1_AND_LATER_BUT_DEPRECATED | ||
* | ||
* Used on declarations introduced in GRMustache 4.1, | ||
* and deprecated in GRMustache 4.1 | ||
*/ | ||
#if GRMUSTACHE_VERSION_MIN_REQUIRED >= GRMUSTACHE_VERSION_4_1 | ||
#define AVAILABLE_GRMUSTACHE_VERSION_4_1_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE | ||
#else | ||
#define AVAILABLE_GRMUSTACHE_VERSION_4_1_AND_LATER_BUT_DEPRECATED AVAILABLE_GRMUSTACHE_VERSION_4_1_AND_LATER | ||
#endif | ||
|
||
/* | ||
* AVAILABLE_GRMUSTACHE_VERSION_4_0_AND_LATER_BUT_DEPRECATED_IN_GRMUSTACHE_VERSION_4_1 | ||
* | ||
* Used on declarations introduced in GRMustache 4.0, | ||
* but later deprecated in GRMustache 4.1 | ||
*/ | ||
#if GRMUSTACHE_VERSION_MIN_REQUIRED >= GRMUSTACHE_VERSION_4_1 | ||
#define AVAILABLE_GRMUSTACHE_VERSION_4_0_AND_LATER_BUT_DEPRECATED_IN_GRMUSTACHE_VERSION_4_1 DEPRECATED_ATTRIBUTE | ||
#else | ||
#define AVAILABLE_GRMUSTACHE_VERSION_4_0_AND_LATER_BUT_DEPRECATED_IN_GRMUSTACHE_VERSION_4_1 AVAILABLE_GRMUSTACHE_VERSION_4_0_AND_LATER | ||
#endif | ||
|
||
/* | ||
* DEPRECATED_IN_GRMUSTACHE_VERSION_4_1_AND_LATER | ||
* | ||
* Used on types deprecated in GRMustache 4.1 | ||
*/ | ||
#if GRMUSTACHE_VERSION_MIN_REQUIRED >= GRMUSTACHE_VERSION_4_1 | ||
#define DEPRECATED_IN_GRMUSTACHE_VERSION_4_1_AND_LATER DEPRECATED_ATTRIBUTE | ||
#else | ||
#define DEPRECATED_IN_GRMUSTACHE_VERSION_4_1_AND_LATER | ||
#endif | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// The MIT License | ||
// | ||
// Copyright (c) 2012 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 "TextualApplication.h" | ||
|
||
|
||
/** | ||
* The domain of a GRMustache-generated NSError | ||
* | ||
* @since v1.0 | ||
*/ | ||
extern NSString* const GRMustacheErrorDomain AVAILABLE_GRMUSTACHE_VERSION_4_0_AND_LATER; | ||
|
||
/** | ||
* The codes of a GRMustache-generated NSError | ||
* | ||
* @since v1.0 | ||
*/ | ||
typedef enum { | ||
/** | ||
* The error code for parse errors. | ||
* | ||
* @since v1.0 | ||
*/ | ||
GRMustacheErrorCodeParseError, | ||
|
||
/** | ||
* The error code for not found templates and partials. | ||
* | ||
* @since v1.0 | ||
*/ | ||
GRMustacheErrorCodeTemplateNotFound, | ||
} GRMustacheErrorCode AVAILABLE_GRMUSTACHE_VERSION_4_0_AND_LATER; | ||
|
||
|
Oops, something went wrong.