Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Document v4.3 refactoring in forking.md

  • Loading branch information...
commit 310e2eb3fff12bd7846d216d235108f565eec108 1 parent 89a4d5d
@groue authored
Showing with 19 additions and 5 deletions.
  1. +19 −5 Guides/forking.md
View
24 Guides/forking.md
@@ -15,10 +15,22 @@ The library features are described in the [guides](templates.md). This section d
- **Parsing**
- `GRMustacheParser`
- `GRMustacheToken`
+ - `GRMustacheExpression`
+ - `GRMustacheFilteredExpression`
+ - `GRMustacheIdentifierExpression`
+ - `GRMustacheImplicitIteratorExpression`
+ - `GRMustacheScopedExpression`
The *parser* is able to produce a [parse tree](http://en.wikipedia.org/wiki/Parse_tree) of *tokens* out of a template string.
For instance, a parser generates three tokens from `Hello {{name}}!`: two text tokens and a variable token.
+
+ Some tokens contain an *expression*. Expressions will go live during the rendering of a template (see below), being able to compute rendered values:
+
+ - `{{ name }}` contains an *identifier expression*.
+ - `{{ . }}` contains an *implicit iterator expression*.
+ - `{{ person.name }}` contains a *scoped expression*.
+ - `{{ uppercase(name) }}` contains a *filtered expression*.
- **Compiling**
- `GRMustacheCompiler`
@@ -36,6 +48,8 @@ The library features are described in the [guides](templates.md). This section d
- **Runtime**
- `GRMustacheContext`
+ - `GRMustacheFilter`
+ - `GRMustacheFilterLibrary`
- `GRMustacheHelper`
- `GRMustacheInvocation`
- `GRMustacheSection`
@@ -45,13 +59,13 @@ The library features are described in the [guides](templates.md). This section d
A context is able to provide the value for an identifier such as `name` found in a `{{name}}` tag.
- However, it is not fully responsible for the value lookup. *Invocations* are the definitive objects that provide values that should be rendered. For instance, invocations are able to perform a lookup for key paths such as `foo.bar`.
+ However, contexts are not responsible for providing values that should be rendered. Expressions built at the parsing phase are. For instance, expressions are able to perform a lookup for scoped expressions such as `person.name`, or apply filters such as `uppercase(name)`. The *filter library* provides with built-in filters.
- Invocations are generated by the compiler. Each variable and section element, also generated by the compiler, owns an invocation that provides the value that should be rendered.
-
- Those invocations are exposed to the *template delegate*, so that the library user can inspect or override values that are rendered.
+ *Invocations* are generated by expressions, and exposed to the *template delegate*, so that the library user can inspect or override values that are rendered.
- There is another way for the library user to hook into the template rendering: she can implement *helpers* in order to have some sections behave as "Mustache lambda sections". In order to be able to perform the job described by the Mustache specification, they are provided with *section* objects that provide the minimum required information.
+ The library user can implement *helpers* in order to have some sections behave as "Mustache lambda sections". In order to be able to perform the job described by the Mustache specification, they are provided with *section* objects that provide the minimum required information.
+
+ Finally, the library user can implement her own *filters*, that will add to the built-in ones.
- **Template repositories**
- `GRMustacheTemplateRepository`
Please sign in to comment.
Something went wrong with that request. Please try again.