Browse code

[Docs] Some minor fixes: Typos, Notations

Philipp Rieber authored on 23/11/2013 14:12:47
Showing 14 changed files
... ...
@@ -211,14 +211,14 @@ Automatic Escaping
211 211
 ~~~~~~~~~~~~~~~~~~
212 212
 
213 213
 If automatic escaping is enabled, the output of the filter may be escaped
214
-before printing. If your filter acts as an escaper (or explicitly outputs html
214
+before printing. If your filter acts as an escaper (or explicitly outputs HTML
215 215
 or JavaScript code), you will want the raw output to be printed. In such a
216 216
 case, set the ``is_safe`` option::
217 217
 
218 218
     $filter = new Twig_SimpleFilter('nl2br', 'nl2br', array('is_safe' => array('html')));
219 219
 
220 220
 Some filters may need to work on input that is already escaped or safe, for
221
-example when adding (safe) html tags to originally unsafe output. In such a
221
+example when adding (safe) HTML tags to originally unsafe output. In such a
222 222
 case, set the ``pre_escape`` option to escape the input data before it is run
223 223
 through your filter::
224 224
 
... ...
@@ -278,7 +278,7 @@ to create an instance of ``Twig_SimpleTest``::
278 278
     $twig->addTest($test);
279 279
 
280 280
 Tests allow you to create custom application specific logic for evaluating
281
-boolean conditions. As a simple, example let's create a Twig test that checks if
281
+boolean conditions. As a simple example, let's create a Twig test that checks if
282 282
 objects are 'red'::
283 283
 
284 284
     $twig = new Twig_Environment($loader)
... ...
@@ -244,14 +244,14 @@ Automatic Escaping
244 244
 ~~~~~~~~~~~~~~~~~~
245 245
 
246 246
 If automatic escaping is enabled, the output of the filter may be escaped
247
-before printing. If your filter acts as an escaper (or explicitly outputs html
248
-or javascript code), you will want the raw output to be printed. In such a
247
+before printing. If your filter acts as an escaper (or explicitly outputs HTML
248
+or JavaScript code), you will want the raw output to be printed. In such a
249 249
 case, set the ``is_safe`` option::
250 250
 
251 251
     $filter = new Twig_Filter_Function('nl2br', array('is_safe' => array('html')));
252 252
 
253 253
 Some filters may need to work on input that is already escaped or safe, for
254
-example when adding (safe) html tags to originally unsafe output. In such a
254
+example when adding (safe) HTML tags to originally unsafe output. In such a
255 255
 case, set the ``pre_escape`` option to escape the input data before it is run
256 256
 through your filter::
257 257
 
... ...
@@ -417,15 +417,15 @@ The escaping rules are implemented as follows:
417 417
         {{ var|upper|raw }} {# won't be escaped #}
418 418
 
419 419
 * Automatic escaping is not applied if the last filter in the chain is marked
420
-  safe for the current context (e.g. ``html`` or ``js``). ``escaper`` and
421
-  ``escaper('html')`` are marked safe for html, ``escaper('js')`` is marked
422
-  safe for javascript, ``raw`` is marked safe for everything.
420
+  safe for the current context (e.g. ``html`` or ``js``). ``escape`` and
421
+  ``escape('html')`` are marked safe for HTML, ``escape('js')`` is marked
422
+  safe for JavaScript, ``raw`` is marked safe for everything.
423 423
 
424 424
   .. code-block:: jinja
425 425
 
426 426
         {% autoescape 'js' %}
427
-            {{ var|escape('html') }} {# will be escaped for html and javascript #}
428
-            {{ var }} {# will be escaped for javascript #}
427
+            {{ var|escape('html') }} {# will be escaped for HTML and JavaScript #}
428
+            {{ var }} {# will be escaped for JavaScript #}
429 429
             {{ var|escape('js') }} {# won't be double-escaped #}
430 430
         {% endautoescape %}
431 431
 
... ...
@@ -8,7 +8,7 @@ The ``format`` filter formats a given string by replacing the placeholders
8 8
 
9 9
     {{ "I like %s and %s."|format(foo, "bar") }}
10 10
 
11
-    {# returns I like foo and bar
11
+    {# outputs I like foo and bar
12 12
        if the foo parameter equals to the foo string. #}
13 13
 
14 14
 .. _`sprintf`: http://www.php.net/sprintf
... ...
@@ -15,7 +15,7 @@ define it with the optional first parameter:
15 15
 .. code-block:: jinja
16 16
 
17 17
     {{ [1, 2, 3]|join('|') }}
18
-    {# returns 1|2|3 #}
18
+    {# outputs 1|2|3 #}
19 19
 
20 20
 Arguments
21 21
 ---------
... ...
@@ -7,6 +7,6 @@ if ``raw`` is the last filter applied to it:
7 7
 
8 8
 .. code-block:: jinja
9 9
 
10
-    {% autoescape true %}
10
+    {% autoescape %}
11 11
         {{ var|raw }} {# var won't be escaped #}
12 12
     {% endautoescape %}
... ...
@@ -8,7 +8,7 @@ The ``replace`` filter formats a given string by replacing the placeholders
8 8
 
9 9
     {{ "I like %this% and %that%."|replace({'%this%': foo, '%that%': "bar"}) }}
10 10
 
11
-    {# returns I like foo and bar
11
+    {# outputs I like foo and bar
12 12
        if the foo parameter equals to the foo string. #}
13 13
 
14 14
 Arguments
... ...
@@ -18,7 +18,7 @@ parameter type:
18 18
 
19 19
     {{ random(['apple', 'orange', 'citrus']) }} {# example output: orange #}
20 20
     {{ random('ABC') }}                         {# example output: C #}
21
-    {{ random() }}                              {# example output: 15386094 (works as native PHP `mt_rand`_ function) #}
21
+    {{ random() }}                              {# example output: 15386094 (works as the native PHP mt_rand function) #}
22 22
     {{ random(5) }}                             {# example output: 3 #}
23 23
 
24 24
 Arguments
... ...
@@ -9,7 +9,7 @@ Returns a list containing an arithmetic progression of integers:
9 9
         {{ i }},
10 10
     {% endfor %}
11 11
 
12
-    {# returns 0, 1, 2, 3 #}
12
+    {# outputs 0, 1, 2, 3, #}
13 13
 
14 14
 When step is given (as the third parameter), it specifies the increment (or
15 15
 decrement):
... ...
@@ -20,7 +20,7 @@ decrement):
20 20
         {{ i }},
21 21
     {% endfor %}
22 22
 
23
-    {# returns 0, 2, 4, 6 #}
23
+    {# outputs 0, 2, 4, 6, #}
24 24
 
25 25
 The Twig built-in ``..`` operator is just syntactic sugar for the ``range``
26 26
 function (with a step of 1):
... ...
@@ -2,7 +2,7 @@
2 2
 ==========
3 3
 
4 4
 .. versionadded:: 1.15
5
-    The include function was added in Twig 1.15.
5
+    The source function was added in Twig 1.15.
6 6
 
7 7
 The ``source`` function returns the content of a template without rendering it:
8 8
 
... ...
@@ -9,7 +9,7 @@ Installing the Twig PHP package
9 9
 Installing via Composer (recommended)
10 10
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 11
 
12
-1. Install composer in your project:
12
+1. Install Composer in your project:
13 13
 
14 14
 .. code-block:: bash
15 15
 
... ...
@@ -25,7 +25,7 @@ Installing via Composer (recommended)
25 25
         }
26 26
     }
27 27
 
28
-3. Install via composer
28
+3. Install via Composer
29 29
 
30 30
 .. code-block:: bash
31 31
 
... ...
@@ -335,7 +335,7 @@ you have some dynamic JavaScript files thanks to the ``autoescape`` tag:
335 335
 
336 336
 But if you have many HTML and JS files, and if your template names follow some
337 337
 conventions, you can instead determine the default escaping strategy to use
338
-based on the template name. Let's say that your template names always ends
338
+based on the template name. Let's say that your template names always end
339 339
 with ``.html`` for HTML files, ``.js`` for JavaScript ones, and ``.css`` for
340 340
 stylesheets, here is how you can configure Twig::
341 341
 
... ...
@@ -35,7 +35,7 @@ but without the associated complexity:
35 35
     {% block content %}{% endblock %}
36 36
 
37 37
 The ``use`` statement tells Twig to import the blocks defined in
38
-```blocks.html`` into the current template (it's like macros, but for blocks):
38
+``blocks.html`` into the current template (it's like macros, but for blocks):
39 39
 
40 40
 .. code-block:: jinja
41 41
 
... ...
@@ -10,5 +10,5 @@ another variable:
10 10
 .. code-block:: jinja
11 11
 
12 12
     {% if foo.attribute is same as(false) %}
13
-        the foo attribute really is the ``false`` PHP value
13
+        the foo attribute really is the 'false' PHP value
14 14
     {% endif %}