Permalink
Browse files

Make clear in guide that variable tag helpers can also be delegates.

  • Loading branch information...
1 parent 1a7b646 commit 26f510c01d081048ab646cf027674478345c40b5 @groue committed Oct 12, 2012
Showing with 13 additions and 9 deletions.
  1. +10 −6 Guides/delegate.md
  2. +1 −1 Guides/sample_code/localization.md
  3. +1 −1 RELEASE_NOTES.md
  4. +1 −1 src/classes/GRMustacheRuntime_private.h
View
16 Guides/delegate.md
@@ -6,15 +6,19 @@ GRMustacheTemplateDelegate protocol
This protocol lets you observe, and possibly alter the rendering of a template.
-Template delegate and section delegates
----------------------------------------
+Template delegate and tag delegates
+-----------------------------------
While rendering a template, several objects may get messages from GRMustache:
- The template's delegate itself, which you set via the `delegate` property of the GRMustacheTemplate class.
-- Objects attached to section tags, as long as they conform to the GRMustacheTemplateDelegate protocol.
+- Objects attached to section and variable tags, as long as they conform to the GRMustacheTemplateDelegate protocol.
-The template's delegate can observe the full template rendering. However, Delegates of section tags can only observe the rendering of their inner content. As sections get nested, a template gets more and more delegates.
+The template's delegate can observe the full template rendering.
+
+Section tag delegates can only observe the rendering of their inner content. As sections get nested, a template would get more and more delegates.
+
+[Variable tag helpers](variable_tag_helpers.md) can also be delegates, and observe their own rendering.
You'll find template delegate usages below. Delegates of section tags are used in the [localization](sample_code/localization.md) sample code.
@@ -31,7 +35,7 @@ The following methods are called before, and after the whole template rendering:
- (void)templateDidRender:(GRMustacheTemplate *)template;
```
-Delegates of section tags are not sent these messages. Only template delegates are.
+Tag delegates are not sent these messages. Only template delegates are.
### Tag rendering
@@ -124,7 +128,7 @@ GRMustacheTemplateDelegate will help you when you can not, or do not want, to em
Sample code
-----------
-The [localization.md](sample_code/localization.md) sample code uses delegates of section tags for localizing portions of a template.
+The [localization.md](sample_code/localization.md) sample code uses section tag delegate for localizing portions of a template.
[up](introduction.md), [next](../../../tree/master/Guides/sample_code)
View
2 Guides/sample_code/localization.md
@@ -169,7 +169,7 @@ The [GRMustacheDelegate](../delegate.md) protocol is a nifty tool: it lets you k
This looks like a nice way to build our format arguments and the localizable format string in a single strike: instead of letting GRMustache render `Arthur` and `Barbara`, we'll put those values away, and tell the library to render `%@` instead.
-We'll thus now attach to the `localize` section an object that conforms to *both* the `GRMustacheSectionTagHelper` and `GRMustacheTemplateDelegate` protocols. As in the previous example, we'll perform a "double-pass" rendering: the first rendering will use the delegate side, build the localizable format string, and fill the format arguments. The second rendering will simply mix the format and the arguments.
+We'll thus now attach to the `localize` section an object that conforms to *both* the `GRMustacheSectionTagHelper` and `GRMustacheTemplateDelegate` protocols. As in the previous example, we'll perform a "double-pass" rendering: the first rendering will use the delegate facet, build the localizable format string, and fill the format arguments. The second rendering will simply mix the format and the arguments.
Now the convenient `[GRMustacheSectionTagHelper helperWithBlock:]` method is not enough. Let's go for a full class:
View
2 RELEASE_NOTES.md
@@ -11,7 +11,7 @@ You can compare the performances of GRMustache versions at https://github.com/gr
## v5.4.3
-Until this version, GRMustache would not trigger section tag helpers, variable tag helpers and section delegates in a few corner cases.
+Until this version, GRMustache would not trigger section tag helpers, variable tag helpers and tag delegates in a few corner cases.
## v5.4.2
View
2 src/classes/GRMustacheRuntime_private.h
@@ -50,7 +50,7 @@ extern BOOL GRMustacheRuntimeDidCatchNSUndefinedKeyException;
* - provide the current context object.
* - perform a key lookup in the context stack.
* - perform a key lookup in the filter stack.
- * - let template and section delegates interpret rendered values.
+ * - let template and tag delegates interpret rendered values.
*/
@interface GRMustacheRuntime : NSObject {
BOOL _parentHasContext;

0 comments on commit 26f510c

Please sign in to comment.