GRMustacheTag Class Reference
Inherits from | NSObject |
Declared in | GRMustacheTag.h |
Overview
GRMustacheTag instances represent Mustache tags that render values, such as
a variable tag {{ name }}
, or a section tag {{# name }}...{{/ })
.
Companion guides:
Tasks
Tag Information
-
type
property -
innerTemplateString
property -
– description
Methods Dedicated to the GRMustacheRendering Protocol
Properties
innerTemplateString
Returns the literal and unprocessed inner content of the tag.
@property (nonatomic, readonly) NSString *innerTemplateString
Discussion
A section tag such as {{# name }}inner content{{/}}
returns inner content
.
Variable tags such as {{ name }}
have no inner content: their inner
template string is the empty string.
Declared In
GRMustacheTag.h
templateRepository
This method is deprecated. (Deprecated: v7.0)
@property (nonatomic, readonly) GRMustacheTemplateRepository *templateRepository
Availability
v6.0
Discussion
Replace [tag.templateRepository templateFromString:... error:...]
with
[
GRMustacheTemplate templateFromString:... error:...]
.
Replace [tag.templateRepository templateNamed:... error:...]
with explicit
invocation of the targeted template repository.
Declared In
GRMustacheTag.h
Instance Methods
description
Returns the description of the tag.
- (NSString *)description
Discussion
For example:
<GRMustacheVariableTag `{{ name }}` at line 18 of template /path/to/Document.mustache>
Declared In
GRMustacheTag.h
renderContentWithContext:HTMLSafe:error:
Returns the rendering of the tag’s inner content, rendering all inner Mustache tags with the rendering context argument.
- (NSString *)renderContentWithContext:(GRMustacheContext *)context HTMLSafe:(BOOL *)HTMLSafe error:(NSError **)error
Parameters
- context
A context for rendering inner tags.
- HTMLSafe
Upon return contains YES or NO, depending on the content type of the tag’s template, as set by the configuration of the source template repository. HTML templates yield YES, text templates yield NO.
- error
If there is an error rendering the tag, upon return contains an NSError object that describes the problem.
Return Value
The rendering of the tag’s inner content.
Discussion
This method is intended for objects conforming to the GRMustacheRendering protocol. The following Guides show some use cases for this method:
- https://github.com/groue/GRMustache/blob/master/Guides/delegate.md
- https://github.com/groue/GRMustache/blob/master/Guides/rendering_objects.md
Note that variable tags such as {{ name }}
have no inner content, and
return the empty string.
See Also
Declared In
GRMustacheTag.h