From: Fabien Potencier Date: Mon, 25 Jul 2011 16:05:31 +0000 (+0200) Subject: fixed PHPDocs for the Token parsers X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=42e410559537baf3120080577b12418099bbdc2f;p=konrad%2Ftwig.git fixed PHPDocs for the Token parsers --- diff --git a/lib/Twig/TokenParser/AutoEscape.php b/lib/Twig/TokenParser/AutoEscape.php index 75c6c5e..3b4b96e 100644 --- a/lib/Twig/TokenParser/AutoEscape.php +++ b/lib/Twig/TokenParser/AutoEscape.php @@ -8,10 +8,10 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** - * - * You can mark a section of a template to be escaped or not by using the autoescape tag: - * + * Marks a section of a template to be escaped or not. + * *
  * {% autoescape true %}
  *   Everything will be automatically escaped in this block
@@ -26,7 +26,6 @@
  *   using the js escaping strategy
  * {% endautoescape %}
  * 
- * */ class Twig_TokenParser_AutoEscape extends Twig_TokenParser { diff --git a/lib/Twig/TokenParser/Block.php b/lib/Twig/TokenParser/Block.php index 54ee61f..b31f7ed 100644 --- a/lib/Twig/TokenParser/Block.php +++ b/lib/Twig/TokenParser/Block.php @@ -9,20 +9,17 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** - * - * Blocks are used for inheritance and act as placeholders and replacements at the same time. + * Marks a section of a template as being reusable. * - * *
  *  {% block head %}
  *    
  *    {% block title %}{% endblock %} - My Webpage
  *  {% endblock %}
  * 
- * - * - */ + */ class Twig_TokenParser_Block extends Twig_TokenParser { /** diff --git a/lib/Twig/TokenParser/Extends.php b/lib/Twig/TokenParser/Extends.php index 4582077..d9fe698 100644 --- a/lib/Twig/TokenParser/Extends.php +++ b/lib/Twig/TokenParser/Extends.php @@ -9,19 +9,14 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** - * - * The extends tag can be used to extend a template from another one. - * You can have multiple of them in a file but only one of them may be executed at the time. - * There is no support for multiple inheritance. + * Extends a template by another one. * - * *
  *  {% extends "base.html" %}
  * 
- * - * - */ + */ class Twig_TokenParser_Extends extends Twig_TokenParser { /** diff --git a/lib/Twig/TokenParser/Filter.php b/lib/Twig/TokenParser/Filter.php index 2117eaa..0969ab1 100644 --- a/lib/Twig/TokenParser/Filter.php +++ b/lib/Twig/TokenParser/Filter.php @@ -8,18 +8,15 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** - * - * Filter sections allow you to apply regular Twig filters on a block of template data. Just wrap the code in the special filter section: + * Filters a section of a template by applying filters. * - * *
  * {% filter upper %}
  *  This text becomes uppercase
  * {% endfilter %}
  * 
- * - * */ class Twig_TokenParser_Filter extends Twig_TokenParser { diff --git a/lib/Twig/TokenParser/For.php b/lib/Twig/TokenParser/For.php index 3cc7c59..45632a7 100644 --- a/lib/Twig/TokenParser/For.php +++ b/lib/Twig/TokenParser/For.php @@ -9,21 +9,18 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** - * - * Loop over each item in a sequence. For example, to display a list of users provided in a variable called users: + * Loops over each item of a sequence. * - * *
  *  
+ * 
  * 
- * - * - */ + */ class Twig_TokenParser_For extends Twig_TokenParser { /** diff --git a/lib/Twig/TokenParser/From.php b/lib/Twig/TokenParser/From.php index b26a4fb..87aceb4 100644 --- a/lib/Twig/TokenParser/From.php +++ b/lib/Twig/TokenParser/From.php @@ -8,6 +8,14 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + +/** + * Imports macros. + * + *
+ *   {% from 'forms.html' import forms %}
+ * 
+ */ class Twig_TokenParser_From extends Twig_TokenParser { /** diff --git a/lib/Twig/TokenParser/If.php b/lib/Twig/TokenParser/If.php index 17a6a9a..65a1a8b 100644 --- a/lib/Twig/TokenParser/If.php +++ b/lib/Twig/TokenParser/If.php @@ -9,9 +9,9 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** - * - * The if statement in Twig is comparable with the if statements of PHP. In the simplest form you can use it to test if a variable is not empty: + * Tests a condition. * *
  * {% if users %}
@@ -22,8 +22,6 @@
  *  
  * {% endif %}
  * 
- * - * */ class Twig_TokenParser_If extends Twig_TokenParser { diff --git a/lib/Twig/TokenParser/Import.php b/lib/Twig/TokenParser/Import.php index 6a9ad6f..d0a88cd 100644 --- a/lib/Twig/TokenParser/Import.php +++ b/lib/Twig/TokenParser/Import.php @@ -8,17 +8,13 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** - * - * Twig supports putting often used code into macros. - * These macros can go into different templates and get imported from there. + * Imports macros. * - * *
  *   {% import 'forms.html' as forms %}
  * 
- * - * */ class Twig_TokenParser_Import extends Twig_TokenParser { diff --git a/lib/Twig/TokenParser/Include.php b/lib/Twig/TokenParser/Include.php index 0a983da..b939ed6 100644 --- a/lib/Twig/TokenParser/Include.php +++ b/lib/Twig/TokenParser/Include.php @@ -9,18 +9,15 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** - * - * The include statement is useful to include a template and return the rendered content of that file into the current namespace: + * Includes a template. * - * *
  *   {% include 'header.html' %}
  *     Body
  *   {% include 'footer.html' %}
  * 
- * - * */ class Twig_TokenParser_Include extends Twig_TokenParser { diff --git a/lib/Twig/TokenParser/Macro.php b/lib/Twig/TokenParser/Macro.php index e25c3a8..da1ac55 100644 --- a/lib/Twig/TokenParser/Macro.php +++ b/lib/Twig/TokenParser/Macro.php @@ -8,20 +8,15 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** - * - * 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 is a small example of a macro that renders a form element: + * Defines a macro. * - * *
  * {% macro input(name, value, type, size) %}
  *    
  * {% endmacro %}
  * 
- * - * */ class Twig_TokenParser_Macro extends Twig_TokenParser { diff --git a/lib/Twig/TokenParser/Sandbox.php b/lib/Twig/TokenParser/Sandbox.php index 90971d3..62e7f8f 100644 --- a/lib/Twig/TokenParser/Sandbox.php +++ b/lib/Twig/TokenParser/Sandbox.php @@ -8,9 +8,9 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** - * The sandbox extension can be used to evaluate untrusted code. Access to unsafe attributes and methods is prohibited. - * + * Marks a section of a template as untrusted code that must be evaluated in the sandbox mode. * *
  * {% sandbox %}
@@ -19,7 +19,6 @@
  * 
* * @see http://www.twig-project.org/doc/api.html#sandbox-extension for details - * */ class Twig_TokenParser_Sandbox extends Twig_TokenParser { diff --git a/lib/Twig/TokenParser/Set.php b/lib/Twig/TokenParser/Set.php index 6d294d5..489e1d3 100644 --- a/lib/Twig/TokenParser/Set.php +++ b/lib/Twig/TokenParser/Set.php @@ -8,10 +8,10 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** - * - * Inside code blocks you can also assign values to variables. Assignments use the set tag and can have multiple targets: - * + * Defines a variable. + * *
  *  {% set foo = 'foo' %}
  *
@@ -25,8 +25,6 @@
  *
  *  {% set foo %}Some content{% endset %}
  * 
- * - * */ class Twig_TokenParser_Set extends Twig_TokenParser { diff --git a/lib/Twig/TokenParser/Spaceless.php b/lib/Twig/TokenParser/Spaceless.php index 064f54f..aa7ffbc 100644 --- a/lib/Twig/TokenParser/Spaceless.php +++ b/lib/Twig/TokenParser/Spaceless.php @@ -8,8 +8,9 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** - * Use the spaceless tag to remove whitespace between HTML tags: + * Remove whitespaces between HTML tags. * *
  * {% spaceless %}
@@ -17,10 +18,9 @@
  *          foo
  *      
  * {% endspaceless %}
- * 
+ *
  * {# output will be 
foo
#} *
- * */ class Twig_TokenParser_Spaceless extends Twig_TokenParser { diff --git a/lib/Twig/TokenParser/Use.php b/lib/Twig/TokenParser/Use.php index c7ff6fe..16c47e3 100644 --- a/lib/Twig/TokenParser/Use.php +++ b/lib/Twig/TokenParser/Use.php @@ -8,8 +8,9 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** - * The use statement tells Twig to import the blocks defined in another template into the current template (it’s like macros, but for blocks): + * Imports blocks defined in another template into the current template. * *
  * {% extends "base.html" %}