Skip to content
Newer
Older
100644 99 lines (54 sloc) 4.75 KB
f01775d @groue README
authored Nov 1, 2010
1 GRMustache
2 ==========
3
acb8902 @groue wording
authored Jan 24, 2012
4 GRMustache is an Objective-C implementation of the [Mustache](http://mustache.github.com/) logic-less template engine.
f01775d @groue README
authored Nov 1, 2010
5
4f1625f @groue guides
authored Jan 24, 2012
6 The Mustache syntax: http://mustache.github.com/mustache.5.html (not wrong, but somewhat outdated).
f01775d @groue README
authored Nov 1, 2010
7
4f1625f @groue guides
authored Jan 24, 2012
8 A list of Mustache implementations in other languages: http://mustache.github.com/
f01775d @groue README
authored Nov 1, 2010
9
4f1625f @groue guides
authored Jan 24, 2012
10 Breaking news on Twitter: http://twitter.com/GRMustache
070c126 @groue dot variable extension
authored Nov 2, 2010
11
f52da9d @groue README+RELEASE_NOTES for GRMustacheNumberFormatterHelper and GRMustac…
authored Jan 24, 2012
12
4f1625f @groue guides
authored Jan 24, 2012
13 What you get
14 ------------
f52da9d @groue README+RELEASE_NOTES for GRMustacheNumberFormatterHelper and GRMustac…
authored Jan 24, 2012
15
4f1625f @groue guides
authored Jan 24, 2012
16 **An ARC-compatible static library**, that will run on your computers, devices, simulators.
18dc85c @groue v1.8.0
authored Oct 8, 2011
17
acb8902 @groue wording
authored Jan 24, 2012
18 **MacOS 10.6+, iPhoneOS 3.0, iOS 4.0+ support**
19
8b93b8b @groue wording
authored Feb 2, 2012
20 **Compatibility with other Mustache implementations**: [Mustache specification v1.1.2](https://github.com/mustache/spec) conformance, and a touch of [Handlebars.js](https://github.com/wycats/handlebars.js) (details in [guides/flavors.md](GRMustache/blob/master/guides/flavors.md)).
4f1625f @groue guides
authored Jan 24, 2012
21
22 **Compatibility with previous GRMustache versions**: update GRMustache, enjoy performance improvements and bugfixes, and don't change a line of your code.
945eb6d @groue more README
authored Nov 1, 2010
23
164f533 @groue wording
authored Feb 2, 2012
24 **Number and date formatting.** Handy, and built-in.
18dc85c @groue v1.8.0
authored Oct 8, 2011
25
90b8751 @groue guide links get crazy
authored Feb 2, 2012
26 **Guides**: GRMustache online documentation is provided as guides. The first one tells you how to embed GRMustache in your XCode project: [guides/embedding.md](GRMustache/blob/master/guides/embedding.md).
18dc85c @groue v1.8.0
authored Oct 8, 2011
27
28
4f1625f @groue guides
authored Jan 24, 2012
29 Usage
f52da9d @groue README+RELEASE_NOTES for GRMustacheNumberFormatterHelper and GRMustac…
authored Jan 24, 2012
30 -----
31
4f1625f @groue guides
authored Jan 24, 2012
32 GRMustache rendering is the combination of a template string and of an object that will provide the data.
f52da9d @groue README+RELEASE_NOTES for GRMustacheNumberFormatterHelper and GRMustac…
authored Jan 24, 2012
33
1f63119 @groue wording
authored Feb 9, 2012
34 You can render templates on the fly:
35
4f1625f @groue guides
authored Jan 24, 2012
36 #import "GRMustache.h"
37
38 NSString *templateString = @"Hello {{name}}!";
39 Person *arthur = [Person personWithName:@"Arthur"];
40
1a1555f @groue guides wip
authored Jan 25, 2012
41 // Returns "Hello Arthur!"
4f1625f @groue guides
authored Jan 24, 2012
42 [GRMustacheTemplate renderObject:arthur
43 fromString:templateString
44 error:NULL];
f52da9d @groue README+RELEASE_NOTES for GRMustacheNumberFormatterHelper and GRMustac…
authored Jan 24, 2012
45
1f63119 @groue wording
authored Feb 9, 2012
46 You can also parse a template once, and render it many times.
47
48 GRMustacheTemplate *template = [GRMustacheTemplate parseString:templateString error:NULL];
49 [template renderObject:arthur];
50 [template renderObject:...];
51
52 Speaking of templates, GRMustache eats many kinds of them: files and bundle resources as well as raw strings. For more information, check [guides/templates.md](GRMustache/blob/master/guides/templates.md).
f52da9d @groue README+RELEASE_NOTES for GRMustacheNumberFormatterHelper and GRMustac…
authored Jan 24, 2012
53
90b8751 @groue guide links get crazy
authored Feb 2, 2012
54 Regarding the data objects, GRMustache fetches values with the standard Key-Value Coding `valueForKey:` method. Check [guides/runtime.md](GRMustache/blob/master/guides/runtime.md).
f52da9d @groue README+RELEASE_NOTES for GRMustacheNumberFormatterHelper and GRMustac…
authored Jan 24, 2012
55
4f1625f @groue guides
authored Jan 24, 2012
56 Mustache flavors
137fd2d @groue GRMustacheTemplateLoader documentation goes in its own "Template load…
authored Nov 9, 2010
57 ----------------
58
4f1625f @groue guides
authored Jan 24, 2012
59 GRMustache supports two Mustache flavors : the genuine Mustache, and a bit a [Handlebars.js](https://github.com/wycats/handlebars.js).
137fd2d @groue GRMustacheTemplateLoader documentation goes in its own "Template load…
authored Nov 9, 2010
60
4f1625f @groue guides
authored Jan 24, 2012
61 The main difference lies in the syntax of key paths: genuine Mustache reads `{{foo.bar.baz}}`, while Handlebars reads `{{foo/bar/baz}}` and even `{{../foo/bar/baz}}`.
137fd2d @groue GRMustacheTemplateLoader documentation goes in its own "Template load…
authored Nov 9, 2010
62
90b8751 @groue guide links get crazy
authored Feb 2, 2012
63 If your templates use such compound key paths, you should read [guides/flavors.md](GRMustache/blob/master/guides/flavors.md).
f01775d @groue README
authored Nov 1, 2010
64
65
4f1625f @groue guides
authored Jan 24, 2012
66 Features worth noting
b0976e4 @groue Samples
authored Nov 4, 2010
67 ---------------------
a674b13 @groue README.md: added "a practical example" section
authored Nov 2, 2010
68
4f1625f @groue guides
authored Jan 24, 2012
69 ### Lambda sections
a674b13 @groue README.md: added "a practical example" section
authored Nov 2, 2010
70
4f1625f @groue guides
authored Jan 24, 2012
71 Mustache has "lambda sections". These are sections that allow you to execute custom code, and implement nifty features like caching, filtering, whatever, on portions of your templates.
a674b13 @groue README.md: added "a practical example" section
authored Nov 2, 2010
72
90b8751 @groue guide links get crazy
authored Feb 2, 2012
73 Be sure to read GRMustache's take on the subject: [guides/runtime/helpers.md](GRMustache/blob/master/guides/runtime/helpers.md).
a674b13 @groue README.md: added "a practical example" section
authored Nov 2, 2010
74
4f1625f @groue guides
authored Jan 24, 2012
75 ### Number and Date formatting
a674b13 @groue README.md: added "a practical example" section
authored Nov 2, 2010
76
4f1625f @groue guides
authored Jan 24, 2012
77 GRMustache ships with a few helper classes. One allows you to format all numbers in a section with a `NSNumberFormatter` instance, the other does the same, for dates.
a674b13 @groue README.md: added "a practical example" section
authored Nov 2, 2010
78
90b8751 @groue guide links get crazy
authored Feb 2, 2012
79 They are covered by [guides/number_formatting.md](GRMustache/blob/master/guides/number_formatting.md) and [guides/date_formatting.md](GRMustache/blob/master/guides/date_formatting.md)
a674b13 @groue README.md: added "a practical example" section
authored Nov 2, 2010
80
c0e699e @groue wip
authored Feb 2, 2012
81 Forking
82 -------
83
90b8751 @groue guide links get crazy
authored Feb 2, 2012
84 Please fork. You'll learn useful information in [guides/forking.md](GRMustache/blob/master/guides/forking.md).
c0e699e @groue wip
authored Feb 2, 2012
85
e4bd74e @groue License
authored Nov 1, 2010
86 License
87 -------
88
89 Released under the [MIT License](http://en.wikipedia.org/wiki/MIT_License)
90
4f1625f @groue guides
authored Jan 24, 2012
91 Copyright (c) 2012 Gwendal Roué
e4bd74e @groue License
authored Nov 1, 2010
92
93 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:
94
95 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
96
97 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.
98
Something went wrong with that request. Please try again.