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 guide: https://github.com/groue/GRMustache/blob/master/Guides/rendering_objects.md
Tasks
-
type
The type of the tag
property -
templateRepository
The template repository that did provide the template string from which the receiver tag has been extracted.
property -
innerTemplateString
The literal and unprocessed inner content of the tag, the
property...
in{{# name }}...{{/}}
. -
– renderContentWithContext:HTMLSafe:error:
Returns the rendering of the tag’s inner content, rendering all inner Mustache tags with the rendering context argument.
Properties
innerTemplateString
The literal and unprocessed inner content of the tag, the ...
in
{{# name }}...{{/}}
.
@property (nonatomic, readonly) NSString *innerTemplateString
Discussion
Variable tags such as {{ name }}
have no inner content: their inner
template string is the empty string.
Declared In
GRMustacheTag.h
templateRepository
The template repository that did provide the template string from which the receiver tag has been extracted.
@property (nonatomic, readonly) GRMustacheTemplateRepository *templateRepository
Discussion
Caveat: Make sure you own (retain) template repositories. Don’t use templates
returned by methods like [GRMustacheTemplate templateFrom...]
: they return
autoreleased templates with an implicit autoreleased repository that will
eventually be deallocated when your rendering object tries to access it.
See Also
Declared In
GRMustacheTag.h
Instance Methods
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
Note that variable tags such as {{ name }}
have no inner content, and
return the empty string.
See Also
Declared In
GRMustacheTag.h