Documentation of rendering objects: https://github.com/groue/GRMustache/blob/master/Guides/rendering_objects.md
Created
September 22, 2012 11:04
-
-
Save groue/3765846 to your computer and use it in GitHub Desktop.
GRMustache: variable tag that renders a dynamic partial
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
{{#items}} | |
- {{link}} | |
{{/items}} |
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
<a href="{{url}}">{{title}}</a> |
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
<a href="{{url}}">{{firstName}} {{lastName}}</a> |
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
id data = @{ | |
@"items": @[ | |
@{ // movie | |
@"url": @"/movies/123", | |
@"title": @"Citizen Kane", | |
@"link": [GRMustacheTemplate templateFromResource:@"movie_link" bundle:nil error:NULL], | |
}, | |
@{ // director | |
@"url": @"/people/321", | |
@"firstName": @"Orson", | |
@"lastName": @"Welles", | |
@"link": [GRMustacheTemplate templateFromResource:@"person_link" bundle:nil error:NULL], | |
} | |
] | |
}; | |
NSString *rendering = [GRMustacheTemplate renderObject:data | |
fromResource:@"base" | |
bundle:nil | |
error:NULL]; |
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
- <a href="/movies/123">Citizen Kane</a> | |
- <a href="/people/321">Orson Welles</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment