Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 109 lines (94 sloc) 3.855 kB
b63bbe1 @groue v5.1.0
authored
1 // The MIT License
2 //
3 // Copyright (c) 2012 Gwendal Roué
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 // THE SOFTWARE.
22
23 #import <Foundation/Foundation.h>
24 #import "GRMustacheAvailabilityMacros.h"
25
26 @class GRMustacheVariable;
27
28
29 // =============================================================================
30 #pragma mark - <GRMustacheVariableHelper>
31
32 /**
ed26c85 @groue v5.3.0
authored
33 * Deprecated protocol. Use GRMustacheVariableTagHelper protocol instead.
34 *
35 * The deprecated protocol for implementing Mustache "lambda" variable tags.
b63bbe1 @groue v5.1.0
authored
36 *
37 * The responsability of a GRMustacheVariableHelper is to render a Mustache
38 * variable tag such as `{{name}}`.
39 *
40 * When the data given to a Mustache variable tag is a GRMustacheVariableHelper,
41 * GRMustache invokes the `renderVariable:` method of the helper, and inserts
42 * the raw return value in the template rendering.
43 *
ed26c85 @groue v5.3.0
authored
44 * **Companion guide:** https://github.com/groue/GRMustache/blob/master/Guides/variable_tag_helpers.md
b63bbe1 @groue v5.1.0
authored
45 *
46 * @since v5.1
ed26c85 @groue v5.3.0
authored
47 * @deprecated v5.3
48 *
49 * @see GRMustacheVariableTagHelper
b63bbe1 @groue v5.1.0
authored
50 */
51 @protocol GRMustacheVariableHelper<NSObject>
52 @required
53
54 ////////////////////////////////////////////////////////////////////////////////
55 /// @name Rendering Variable tags
56 ////////////////////////////////////////////////////////////////////////////////
57
58 /**
59 * Returns the rendering of a Mustache variable.
60 *
61 * @param variable The variable to render
62 *
63 * @return The rendering of the variable
64 *
65 * @since v5.1
ed26c85 @groue v5.3.0
authored
66 * @deprecated v5.3
b63bbe1 @groue v5.1.0
authored
67 */
ed26c85 @groue v5.3.0
authored
68 - (NSString *)renderVariable:(GRMustacheVariable *)variable AVAILABLE_GRMUSTACHE_VERSION_5_1_AND_LATER_BUT_DEPRECATED_IN_GRMUSTACHE_VERSION_5_3;
b63bbe1 @groue v5.1.0
authored
69 @end
70
71
72 // =============================================================================
73 #pragma mark - GRMustacheVariableHelper
74
75 /**
9ea08f1 @groue v5.3.0 (with missing public headers)
authored
76 * Deprecated class. Use GRMustacheVariableTagHelper class instead.
77 *
b63bbe1 @groue v5.1.0
authored
78 * The GRMustacheVariableHelper class helps building mustache helpers without
79 * writing a custom class that conforms to the GRMustacheVariableHelper
80 * protocol.
81 *
ed26c85 @groue v5.3.0
authored
82 * **Companion guide:** https://github.com/groue/GRMustache/blob/master/Guides/variable_tag_helpers.md
b63bbe1 @groue v5.1.0
authored
83 *
9ea08f1 @groue v5.3.0 (with missing public headers)
authored
84 * @see GRMustacheVariableTagHelper class
b63bbe1 @groue v5.1.0
authored
85 *
86 * @since v5.1
ed26c85 @groue v5.3.0
authored
87 * @deprecated v5.3
b63bbe1 @groue v5.1.0
authored
88 */
89 @interface GRMustacheVariableHelper: NSObject<GRMustacheVariableHelper>
90
91 ////////////////////////////////////////////////////////////////////////////////
92 /// @name Creating Helpers
93 ////////////////////////////////////////////////////////////////////////////////
94
95 /**
96 * Returns a GRMustacheVariableHelper object that executes the provided block
97 * when rendering a variable tag.
98 *
99 * @param block The block that renders a variable.
100 *
101 * @return a GRMustacheVariableHelper object.
102 *
103 * @since v5.1
104 */
ed26c85 @groue v5.3.0
authored
105 + (id)helperWithBlock:(NSString *(^)(GRMustacheVariable* variable))block AVAILABLE_GRMUSTACHE_VERSION_5_1_AND_LATER_BUT_DEPRECATED_IN_GRMUSTACHE_VERSION_5_3;
b63bbe1 @groue v5.1.0
authored
106
107 @end
108
Something went wrong with that request. Please try again.