From 81006eed2199f753e8ffa6fcafafe255d2395a9f Mon Sep 17 00:00:00 2001 From: Hugo Hamon Date: Sun, 22 Aug 2010 16:34:59 +0200 Subject: [PATCH] [doc] fixed typos in several chapters --- doc/02-Twig-for-Template-Designers.markdown | 38 +++++++++++++------------- doc/03-Twig-for-Developers.markdown | 8 +++--- doc/04-Extending-Twig.markdown | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/doc/02-Twig-for-Template-Designers.markdown b/doc/02-Twig-for-Template-Designers.markdown index 95a7a3a..1dd9d25 100644 --- a/doc/02-Twig-for-Template-Designers.markdown +++ b/doc/02-Twig-for-Template-Designers.markdown @@ -65,7 +65,7 @@ those. You can use a dot (`.`) to access attributes of a variable, alternative the so-called "subscript" syntax (`[]`) can be used. The following lines do the -same:: +same: [twig] {{ foo.bar }} @@ -77,7 +77,7 @@ same:: >braces around. If a variable or attribute does not exist you will get back a `null` value -(which can be testes with the `none` expression). +(which can be tested with the `none` expression). >**SIDEBAR** >Implementation @@ -446,7 +446,7 @@ safe markup. - >**NOTE** ->The chapter for the developers give more information about when and how +>The chapter for developers give more information about when and how >automatic escaping is applied. List of Control Structures @@ -557,7 +557,7 @@ You can also access both keys and values: [twig]

Members

@@ -598,7 +598,7 @@ Macros are comparable with functions in regular programming languages. They are useful to put often used HTML idioms into reusable elements to not repeat yourself. -Here a small example of a macro that renders a form element: +Here is a small example of a macro that renders a form element: [twig] {% macro input(name, value, type, size) %} @@ -635,7 +635,7 @@ The macro can then be called at will:

{{ forms.input('username') }}

{{ forms.input('password', none, 'password') }}

-If the macros are defined and used in the same template, you can use the +If macros are defined and used in the same template, you can use the special `_self` variable, without importing them: [twig] @@ -940,20 +940,20 @@ but exists for completeness' sake. The following operators are supported: * `+`: Adds two objects together (the operands are casted to numbers). `{{ 1 + 1 }}` is `2`. - * `-`: Substract the second number from the first one. `{{ 3 - 2 }}` is `1`. + * `-`: Substracts the second number from the first one. `{{ 3 - 2 }}` is `1`. - * `/`: Divide two numbers. The return value will be a floating point number. + * `/`: Divides two numbers. The return value will be a floating point number. `{{ 1 / 2 }}` is `{{ 0.5 }}`. - * `%`: Calculate the remainder of an integer division. `{{ 11 % 7 }}` is `4`. + * `%`: Calculates the remainder of an integer division. `{{ 11 % 7 }}` is `4`. - * `//`: Divide two numbers and return the truncated integer result. `{{ 20 // + * `//`: Divides two numbers and returns the truncated integer result. `{{ 20 // 7 }}` is `2`. - * `*`: Multiply the left operand with the right one. `{{ 2 * 2 }}` would + * `*`: Multiplies the left operand with the right one. `{{ 2 * 2 }}` would return `4`. - * `**`: Raise the left operand to the power of the right operand. `{{ 2**3 + * `**`: Raises the left operand to the power of the right operand. `{{ 2**3 }}` would return `8`. ### Logic @@ -961,13 +961,13 @@ but exists for completeness' sake. The following operators are supported: For `if` statements, `for` filtering or `if` expressions it can be useful to combine multiple expressions: - * `and`: Return true if the left and the right operand is true. + * `and`: Returns true if the left and the right operands are both true. - * `or`: Return true if the left or the right operand is true. + * `or`: Returns true if the left or the right operand is true. - * `not`: Negate a statement. + * `not`: Negates a statement. - * `(expr)`: Group an expression. + * `(expr)`: Groups an expression. ### Comparisons @@ -986,7 +986,7 @@ The following comparison operators are supported in any expression: `==`, The following operators are very useful but don't fit into any of the other two categories: - * `in` (new in Twig 0.9.5): Perform containment test. Returns `true` if the + * `in` (new in Twig 0.9.5): Performs containment test. Returns `true` if the left operand is contained in the right. {{ 1 in [1, 2, 3] }} would for example return `true`. To perform a negative test, the whole expression should be prefixed with `not` ({{ not 1 in [1, 2, 3] }} would return @@ -1000,7 +1000,7 @@ two categories: * `~`: Converts all operands into strings and concatenates them. `{{ "Hello " ~ name ~ "!" }}` would return (assuming `name` is `'John'`) `Hello John!`. - * `.`, `[]`: Get an attribute of an object. + * `.`, `[]`: Gets an attribute of an object. * `?:`: Twig supports the PHP ternary operator: @@ -1051,7 +1051,7 @@ The array can contain any number of values: ### `urlencode` -The `urlencode` filter URL encode a given string. +The `urlencode` filter URL encodes a given string. ### `title` diff --git a/doc/03-Twig-for-Developers.markdown b/doc/03-Twig-for-Developers.markdown index 5aca49b..665ada6 100644 --- a/doc/03-Twig-for-Developers.markdown +++ b/doc/03-Twig-for-Developers.markdown @@ -100,7 +100,7 @@ The following options are available: >**CAUTION** >Before Twig 0.9.3, the `cache` and `auto_reload` options did not exist. They ->was passed as a second and third arguments of the filesystem loader +>were passed as a second and third arguments of the filesystem loader >respectively. Loaders @@ -116,14 +116,14 @@ system. ### Compilation Cache All template loaders can cache the compiled templates on the filesystem for -future reuse. It speeds up Twig a lot as the templates are only compiled once; +future reuse. It speeds up Twig a lot as templates are only compiled once; and the performance boost is even larger if you use a PHP accelerator such as APC. See the `cache` and `auto_reload` options of `Twig_Environment` above for more information. ### Built-in Loaders -Here a list of the built-in loaders Twig provides: +Here is a list of the built-in loaders Twig provides: * `Twig_Loader_Filesystem`: Loads templates from the file system. This loader can find templates in folders on the file system and is the preferred way @@ -357,7 +357,7 @@ Twig 0.9.5 and above): {{ var|foo(bar) }} {# bar will be escaped #} {{ var|foo(bar|safe) }} {# bar won't be escaped #} - * Automatic escaping is not applied if one of the filter in the chain has the + * Automatic escaping is not applied if one of the filters in the chain has the `is_escaper` option set to `true` (this is the case for the built-in `escaper`, `safe`, and `urlencode` filters for instance). diff --git a/doc/04-Extending-Twig.markdown b/doc/04-Extending-Twig.markdown index f2836ce..bfe5378 100644 --- a/doc/04-Extending-Twig.markdown +++ b/doc/04-Extending-Twig.markdown @@ -76,7 +76,7 @@ An extension is a class that implements the following interface: } To keep your extension class clean and lean, it can inherit from the built-in -`Twig_Extension` class instead of you implementing the whole interface. That +`Twig_Extension` class instead of implementing the whole interface. That way, you just need to implement the `getName()` method as the `Twig_Extension` provides empty implementations for all other methods. -- 1.7.2.5