-
Notifications
You must be signed in to change notification settings - Fork 5
/
GRMustacheTemplateRepository.h
610 lines (574 loc) · 25.5 KB
/
GRMustacheTemplateRepository.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
// The MIT License
//
// Copyright (c) 2012 Gwendal Roué
//
// 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:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// 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.
#import <Foundation/Foundation.h>
#import "GRMustacheAvailabilityMacros.h"
#import "GRMustache.h"
@class GRMustacheTemplate;
@class GRMustacheTemplateRepository;
/**
* The protocol for a GRMustacheTemplateRepository's dataSource.
*
* The dataSource's responsability is to provide Mustache template strings for
* template and partial names.
*
* **Companion guide:** https://github.com/groue/GRMustache/blob/master/Guides/template_repositories.md
*
* @see GRMustacheTemplateRepository
*
* @since v1.13
*/
@protocol GRMustacheTemplateRepositoryDataSource <NSObject>
@required
////////////////////////////////////////////////////////////////////////////////
/// @name Building Template IDs from Template Names
////////////////////////////////////////////////////////////////////////////////
/**
* Returns a template ID, that is to say an object that uniquely identifies a
* template or a template partial.
*
* The class of this ID is opaque: your implementation of a
* GRMustacheTemplateRepositoryDataSource would define, for itself, what kind of
* object would identity a template or a partial.
*
* For instance, a file-based data source may use NSString objects containing
* paths to the templates.
*
* You should try to choose "human-readable" template IDs, because template IDs
* are embedded in the description of errors that may happen during a template
* processing, in order to help the library user locate, and fix, the faulting
* template.
*
* Whenever relevant, template and partial hierarchies are supported via the
* _baseTemplateID_ parameter: it contains the template ID of the enclosing
* template, or nil when the data source is asked for a template ID for a
* partial that is referred from a raw template string (see
* [GRMustacheTemplateRepository templateFromString:error:]).
*
* Not all data sources have to implement hierarchies: they can simply ignore
* this parameter.
*
* Data sources that implement hierarchies have to implement their own support
* for absolute partial paths.
*
* The return value of this method can be nil: the library user would then
* eventually get an NSError of domain GRMustacheErrorDomain and code
* GRMustacheErrorCodeTemplateNotFound.
*
* @param templateRepository The GRMustacheTemplateRepository asking for a
* template ID.
* @param name The name of the template or template partial.
* @param baseTemplateID The template ID of the enclosing template, or nil.
*
* @return a template ID
*
* @since v1.13
*/
- (id<NSCopying>)templateRepository:(GRMustacheTemplateRepository *)templateRepository templateIDForName:(NSString *)name relativeToTemplateID:(id)baseTemplateID AVAILABLE_GRMUSTACHE_VERSION_5_0_AND_LATER;
////////////////////////////////////////////////////////////////////////////////
/// @name Providing Template Strings from Template IDs
////////////////////////////////////////////////////////////////////////////////
/**
* Provided with a template ID that comes from
* templateRepository:templateIDForName:relativeToTemplateID:,
* returns a Mustache template string.
*
* For instance, a file-based data source may interpret the template ID as a
* NSString object containing paths to the template, and return the file
* content.
*
* As usually, whenever this method returns nil, the _outError_ parameter should
* point to a valid NSError. This NSError would eventually reach the library
* user.
*
* @param templateRepository The GRMustacheTemplateRepository asking for a
* Mustache template string.
* @param templateID The template ID of the template
* @param outError If there is an error returning a template string,
* upon return contains nil, or an NSError object
* that describes the problem.
*
* @return a Mustache template string
*
* @since v1.13
*/
- (NSString *)templateRepository:(GRMustacheTemplateRepository *)templateRepository templateStringForTemplateID:(id)templateID error:(NSError **)outError AVAILABLE_GRMUSTACHE_VERSION_5_0_AND_LATER;
@end
/**
* Given a data source that provides Mustache template strings, a
* GRMustacheTemplateRepository's responsability is to provide
* GRMustacheTemplate instances.
*
* You may provide your own template string data source. However common cases
* such as loading templates from URLs, files, bundle resources, and
* dictionaries, are already implemented.
*
* **Companion guide:** https://github.com/groue/GRMustache/blob/master/Guides/template_repositories.md
*
* @see GRMustacheTemplate
* @see GRMustacheTemplateRepositoryDataSource
*
* @since v1.13
*/
@interface GRMustacheTemplateRepository : NSObject {
@private
id<GRMustacheTemplateRepositoryDataSource> _dataSource;
NSMutableDictionary *_templateForTemplateID;
id _currentlyParsedTemplateID;
}
////////////////////////////////////////////////////////////////////////////////
/// @name Building Repositories for Templates stored in the file system
////////////////////////////////////////////////////////////////////////////////
/**
* Returns a GRMustacheTemplateRepository that loads Mustache template strings
* from files of extension .mustache, encoded in UTF8, stored in the provided
* base URL.
*
* For instance:
*
* // Creates a repository for templates stored in /path/to/templates
* NSURL *baseURL = [NSURL fileURLWithPath:@"/path/to/templates"];
* GRMustacheTemplateRepository *repository = [GRMustacheTemplateRepository templateRepositoryWithBaseURL:baseURL];
*
* // Returns a template for the file stored in
* // /path/to/templates/profile.mustache
* GRMustacheTemplate *template = [repository templateForName:@"profile" error:NULL];
*
* A partial tag `{{>partial}}` loads a partial template stored in a file named
* `partial.mustache`, located in the enclosing template's directory.
*
* You may use the slash `/`, and `..`, in order to navigate the URL
* hierarchical system: `{{>partials/achievements}}` would load
* /path/to/templates/partials/achievements.mustache, if invoked from
* /path/to/templates/profile.mustache.
*
* When you ask the repository to parse a raw template string, partials are
* loaded from the base URL:
*
* // The partial would be loaded from
* // /path/to/templates/partials/achievements.mustache
* GRMustacheTemplate *template = [repository templateFromString:@"{{>partials/achievements}}" error:NULL];
*
* @param URL the base URL where to look templates from.
*
* @return a GRMustacheTemplateRepository
*
* @since v1.13
*/
+ (id)templateRepositoryWithBaseURL:(NSURL *)URL AVAILABLE_GRMUSTACHE_VERSION_5_0_AND_LATER;
/**
* Returns a GRMustacheTemplateRepository that loads Mustache template strings
* from files of provided extension, encoded in UTF8, stored in the provided
* base URL.
*
* For instance:
*
* // Creates a repository for templates of extension `.txt` stored in
* // /path/to/templates
* NSURL *baseURL = [NSURL fileURLWithPath:@"/path/to/templates"];
* GRMustacheTemplateRepository *repository = [GRMustacheTemplateRepository templateRepositoryWithBaseURL:baseURL
* templateExtension:@"txt"];
*
* // Returns a template for the file stored in
* // /path/to/templates/profile.txt
* GRMustacheTemplate *template = [repository templateForName:@"profile" error:NULL];
*
* A partial tag `{{>partial}}` loads a partial template stored in a file named
* `partial.txt`, located in the enclosing template's directory.
*
* You may use the slash `/`, and `..`, in order to navigate the URL
* hierarchical system: `{{>partials/achievements}}` would load
* /path/to/templates/partials/achievements.txt, if invoked from
* /path/to/templates/profile.txt.
*
* When you ask the repository to parse a raw template string, partials are
* loaded from the base URL:
*
* // The partial would be loaded from
* // /path/to/templates/partials/achievements.txt
* GRMustacheTemplate *template = [repository templateFromString:@"{{>partials/achievements}}" error:NULL];
*
* @param URL The base URL where to look templates from.
* @param ext The extension of template files.
*
* @return a GRMustacheTemplateRepository
*
* @since v1.13
*/
+ (id)templateRepositoryWithBaseURL:(NSURL *)URL templateExtension:(NSString *)ext AVAILABLE_GRMUSTACHE_VERSION_5_0_AND_LATER;
/**
* Returns a GRMustacheTemplateRepository that loads Mustache template strings
* from files of provided extension, encoded in the provided encoding, stored in
* the provided base URL.
*
* For instance:
*
* // Creates a repository for templates of extension `.txt` stored in
* // /path/to/templates, encoded with NSMacOSRomanStringEncoding:
* NSURL *baseURL = [NSURL fileURLWithPath:@"/path/to/templates"];
* GRMustacheTemplateRepository *repository = [GRMustacheTemplateRepository templateRepositoryWithBaseURL:baseURL
* templateExtension:@"txt"
* encoding:NSMacOSRomanStringEncoding];
*
* // Returns a template for the file stored in
* // /path/to/templates/profile.txt
* GRMustacheTemplate *template = [repository templateForName:@"profile" error:NULL];
*
* A partial tag `{{>partial}}` loads a partial template stored in a file named
* `partial.txt`, located in the enclosing template's directory.
*
* You may use the slash `/`, and `..`, in order to navigate the URL
* hierarchical system: `{{>partials/achievements}}` would load
* /path/to/templates/partials/achievements.txt, if invoked from
* /path/to/templates/profile.txt.
*
* When you ask the repository to parse a raw template string, partials are
* loaded from the base URL:
*
* // The partial would be loaded from
* // /path/to/templates/partials/achievements.txt
* GRMustacheTemplate *template = [repository templateFromString:@"{{>partials/achievements}}" error:NULL];
*
* @param URL The base URL where to look templates from.
* @param ext The extension of template files.
* @param encoding The encoding of template files.
*
* @return a GRMustacheTemplateRepository
*
* @since v1.13
*/
+ (id)templateRepositoryWithBaseURL:(NSURL *)URL templateExtension:(NSString *)ext encoding:(NSStringEncoding)encoding AVAILABLE_GRMUSTACHE_VERSION_5_0_AND_LATER;
/**
* Returns a GRMustacheTemplateRepository that loads Mustache template strings
* from files of extension .mustache, encoded in UTF8, stored in the provided
* directory.
*
* For instance:
*
* // Creates a repository for templates stored in /path/to/templates
* GRMustacheTemplateRepository *repository = [GRMustacheTemplateRepository templateRepositoryWithDirectory:@"/path/to/templates"];
*
* // Returns a template for the file stored in
* // /path/to/templates/profile.mustache
* GRMustacheTemplate *template = [repository templateForName:@"profile" error:NULL];
*
* A partial tag `{{>partial}}` loads a partial template stored in a file named
* `partial.mustache`, located in the enclosing template's directory.
*
* You may use the slash `/`, and `..`, in order to navigate the hierarchical
* file system: `{{>partials/achievements}}` would load
* /path/to/templates/partials/achievements.mustache, if invoked from
* /path/to/templates/profile.mustache.
*
* When you ask the repository to parse a raw template string, partials are
* loaded from the base directory:
*
* // The partial would be loaded from
* // /path/to/templates/partials/achievements.mustache
* GRMustacheTemplate *template = [repository templateFromString:@"{{>partials/achievements}}" error:NULL];
*
* @param path The path of the directory that stores templates.
*
* @return a GRMustacheTemplateRepository
*
* @since v1.13
*/
+ (id)templateRepositoryWithDirectory:(NSString *)path AVAILABLE_GRMUSTACHE_VERSION_5_0_AND_LATER;
/**
* Returns a GRMustacheTemplateRepository that loads Mustache template strings
* from files of provided extension, encoded in UTF8, stored in the provided
* directory.
*
* For instance:
*
* // Creates a repository for templates of extension `.txt` stored in
* // /path/to/templates
* GRMustacheTemplateRepository *repository = [GRMustacheTemplateRepository templateRepositoryWithDirectory:@"/path/to/templates"
* templateExtension:@"txt"];
*
* // Returns a template for the file stored in
* // /path/to/templates/profile.txt
* GRMustacheTemplate *template = [repository templateForName:@"profile" error:NULL];
*
* A partial tag `{{>partial}}` loads a partial template stored in a file named
* `partial.txt`, located in the enclosing template's directory.
*
* You may use the slash `/`, and `..`, in order to navigate the hierarchical
* file system: `{{>partials/achievements}}` would load
* /path/to/templates/partials/achievements.txt, if invoked from
* /path/to/templates/profile.txt.
*
* When you ask the repository to parse a raw template string, partials are
* loaded from the base directory:
*
* // The partial would be loaded from
* // /path/to/templates/partials/achievements.txt
* GRMustacheTemplate *template = [repository templateFromString:@"{{>partials/achievements}}" error:NULL];
*
* @param path The path of the directory that stores templates.
* @param ext The extension of template files.
*
* @return a GRMustacheTemplateRepository
*
* @since v1.13
*/
+ (id)templateRepositoryWithDirectory:(NSString *)path templateExtension:(NSString *)ext AVAILABLE_GRMUSTACHE_VERSION_5_0_AND_LATER;
/**
* Returns a GRMustacheTemplateRepository that loads Mustache template strings
* from files of provided extension, encoded in the provided encoding, stored in
* the provided directory.
*
* For instance:
*
* // Creates a repository for templates of extension `.txt` stored in
* // /path/to/templates, encoded with NSMacOSRomanStringEncoding:
* GRMustacheTemplateRepository *repository = [GRMustacheTemplateRepository templateRepositoryWithDirectory:@"/path/to/templates"
* templateExtension:@"txt"
* encoding:NSMacOSRomanStringEncoding];
*
* // Returns a template for the file stored in
* // /path/to/templates/profile.txt
* GRMustacheTemplate *template = [repository templateForName:@"profile" error:NULL];
*
* A partial tag `{{>partial}}` loads a partial template stored in a file named
* `partial.txt`, located in the enclosing template's directory.
*
* You may use the slash `/`, and `..`, in order to navigate the hierarchical
* file system: `{{>partials/achievements}}` would load
* /path/to/templates/partials/achievements.txt, if invoked from
* /path/to/templates/profile.txt.
*
* When you ask the repository to parse a raw template string, partials are
* loaded from the base directory:
*
* // The partial would be loaded from
* // /path/to/templates/partials/achievements.txt
* GRMustacheTemplate *template = [repository templateFromString:@"{{>partials/achievements}}" error:NULL];
*
* @param path The path of the directory that stores templates.
* @param ext The extension of template files.
* @param encoding The encoding of template files.
*
* @return a GRMustacheTemplateRepository
*
* @since v1.13
*/
+ (id)templateRepositoryWithDirectory:(NSString *)path templateExtension:(NSString *)ext encoding:(NSStringEncoding)encoding AVAILABLE_GRMUSTACHE_VERSION_5_0_AND_LATER;
////////////////////////////////////////////////////////////////////////////////
/// @name Building Repositories for Templates stored as NSBundle resources
////////////////////////////////////////////////////////////////////////////////
/**
* Returns a GRMustacheTemplateRepository that loads Mustache template strings
* from resources of extension .mustache, encoded in UTF8, stored in the
* provided bundle.
*
* For instance:
*
* // Creates a repository for templates stored in the main bundle:
* GRMustacheTemplateRepository *repository = [GRMustacheTemplateRepository templateRepositoryWithBundle:[NSBundle mainBundle]];
*
* // Returns a template for the resource profile.mustache
* GRMustacheTemplate *template = [repository templateForName:@"profile" error:NULL];
*
* You may provide nil for the bundle parameter: the repository will use the
* main bundle.
*
* A partial tag `{{>partial}}` loads a partial template from the
* `partial.mustache` resource in the bundle.
*
* @param bundle The bundle that stores templates as resources.
*
* @return a GRMustacheTemplateRepository
*
* @since v1.13
*/
+ (id)templateRepositoryWithBundle:(NSBundle *)bundle AVAILABLE_GRMUSTACHE_VERSION_5_0_AND_LATER;
/**
* Returns a GRMustacheTemplateRepository that loads Mustache template strings
* from resources of provided extension, encoded in UTF8, stored in the provided
* bundle.
*
* For instance:
*
* // Creates a repository for templates of extension `.txt` stored in the
* // main bundle:
* GRMustacheTemplateRepository *repository = [GRMustacheTemplateRepository templateRepositoryWithBundle:[NSBundle mainBundle]
* templateExtension:@"txt"];
*
* // Returns a template for the resource profile.txt
* GRMustacheTemplate *template = [repository templateForName:@"profile" error:NULL];
*
* You may provide nil for the bundle parameter: the repository will use the
* main bundle.
*
* A partial tag `{{>partial}}` loads a partial template from the `partial.txt`
* resource in the bundle.
*
* @param bundle The bundle that stores templates as resources.
* @param ext The extension of template files.
*
* @return a GRMustacheTemplateRepository
*
* @since v1.13
*/
+ (id)templateRepositoryWithBundle:(NSBundle *)bundle templateExtension:(NSString *)ext AVAILABLE_GRMUSTACHE_VERSION_5_0_AND_LATER;
/**
* Returns a GRMustacheTemplateRepository that loads Mustache template strings
* from resources of provided extension, encoded in the provided encoding,
* stored in the provided bundle.
*
* For instance:
*
* // Creates a repository for templates of extension `.txt` stored in the
* // main bundle, encoded with NSMacOSRomanStringEncoding:
* GRMustacheTemplateRepository *repository = [GRMustacheTemplateRepository templateRepositoryWithBundle:[NSBundle mainBundle]
* templateExtension:@"txt"
* encoding:NSMacOSRomanStringEncoding];
*
* // Returns a template for the resource profile.txt
* GRMustacheTemplate *template = [repository templateForName:@"profile" error:NULL];
*
* You may provide nil for the bundle parameter: the repository will use the
* main bundle.
*
* A partial tag `{{>partial}}` loads a partial template from the `partial.txt`
* resource in the bundle.
*
* @param bundle The bundle that stores templates as resources.
* @param ext The extension of template files.
* @param encoding The encoding of template files.
*
* @return a GRMustacheTemplateRepository
*
* @since v1.13
*/
+ (id)templateRepositoryWithBundle:(NSBundle *)bundle templateExtension:(NSString *)ext encoding:(NSStringEncoding)encoding AVAILABLE_GRMUSTACHE_VERSION_5_0_AND_LATER;
////////////////////////////////////////////////////////////////////////////////
/// @name Building Repositories for Templates stored in Memory
////////////////////////////////////////////////////////////////////////////////
/**
* Returns a GRMustacheTemplateRepository that loads Mustache template strings
* from a dictionary whose keys are template names, and values template strings.
*
* For instance:
*
* NSDictionary *partialsDictionary = [NSDictionary dictionaryWithObject:@"It works." forKey:@"partial"];
* GRMustacheTemplateRepository *repository = [GRMustacheTemplateRepository templateRepositoryWithPartialsDictionary:partialsDictionary];
*
* // Two templates that would render "It works."
* GRMustacheTemplate *template1 = [repository templateForName:@"partial" error:NULL];
* GRMustacheTemplate *template2 = [repository templateFromString:@"{{>partial}}" error:NULL];
*
* @param partialsDictionary A dictionary of whose keys are template names, and
* values Mustache template strings.
*
* @return a GRMustacheTemplateRepository
*
* @since v1.13
*/
+ (id)templateRepositoryWithPartialsDictionary:(NSDictionary *)partialsDictionary AVAILABLE_GRMUSTACHE_VERSION_5_0_AND_LATER;
////////////////////////////////////////////////////////////////////////////////
/// @name Building Repositories using a custom Data Source
////////////////////////////////////////////////////////////////////////////////
/**
* Returns a GRMustacheTemplateRepository.
*
* Until it is provided with a data source, it is unable to load template by
* names, and unable to process partial tags such as `{{>partial}}`:
*
* GRMustacheTemplateRepository *repository = [GRMustacheTemplateRepository templateRepository];
* NSError *error;
*
* // Returns nil, and sets error to an NSError of domain
* // GRMustacheErrorDomain, code GRMustacheErrorCodeTemplateNotFound.
* [repository templateForName:@"foo" error:&error];
*
* // Returns nil, and sets error to an NSError of domain GRMustacheErrorDomain,
* // code GRMustacheErrorCodeTemplateNotFound.
* [repository templateFromString:@"{{>partial}}" error:&error];
*
* It is, however, able to process Mustache template strings without any
* partial:
*
* GRMustacheTemplate *template = [repository templateFromString:@"Hello {{name}}!" error:NULL];
*
* You will give it a data source conforming to the
* GRMustacheTemplateRepositoryDataSource protocol in order to load template and
* partials by name:
*
* repository.dataSource = ...;
*
* // Returns a template built from the string provided by the dataSource.
* [repository templateForName:@"foo" error:NULL];
*
* @return a GRMustacheTemplateRepository
*
* @see GRMustacheTemplateRepositoryDataSource
*
* @since v1.13
*/
+ (id)templateRepository AVAILABLE_GRMUSTACHE_VERSION_5_0_AND_LATER;
/**
* The repository's data source.
*
* @see GRMustacheTemplateRepositoryDataSource
*
* @since v1.13
*/
@property (nonatomic, assign) id<GRMustacheTemplateRepositoryDataSource> dataSource AVAILABLE_GRMUSTACHE_VERSION_5_0_AND_LATER;
////////////////////////////////////////////////////////////////////////////////
/// @name Getting Templates out of a Repository
////////////////////////////////////////////////////////////////////////////////
/**
* Returns a template identified by its name.
*
* Depending on the way the repository has been created, the name identifies a
* URL, a file path, a key in a dictionary, or whatever is relevant to the
* repository's data source.
*
* @param name The template name
* @param outError If there is an error loading or parsing template and
* partials, upon return contains an NSError object that
* describes the problem.
*
* @return a GRMustacheTemplate
*
* @since v1.13
*/
- (GRMustacheTemplate *)templateForName:(NSString *)name error:(NSError **)outError AVAILABLE_GRMUSTACHE_VERSION_5_0_AND_LATER;
/**
* Returns a template built from the provided Mustache template string.
*
* Depending on the way the repository has been created, partial tags such as
* `{{>partial}}` load partial templates from URLs, file paths, keys in a
* dictionary, or whatever is relevant to the repository's data source.
*
* @param templateString A Mustache template string
* @param outError If there is an error loading or parsing template and
* partials, upon return contains an NSError object that
* describes the problem.
*
* @return a GRMustacheTemplate
*
* @since v1.13
*/
- (GRMustacheTemplate *)templateFromString:(NSString *)templateString error:(NSError **)outError AVAILABLE_GRMUSTACHE_VERSION_5_0_AND_LATER;
@end