fixed PHPDocs for the Token parsers

This commit is contained in:
Fabien Potencier
2011-07-25 18:05:31 +02:00
parent e3bd4bdcdd
commit 42e4105595
14 changed files with 41 additions and 64 deletions
+3 -4
View File
@@ -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.
*
* <pre>
* {% autoescape true %}
* Everything will be automatically escaped in this block
@@ -26,7 +26,6 @@
* using the js escaping strategy
* {% endautoescape %}
* </pre>
*
*/
class Twig_TokenParser_AutoEscape extends Twig_TokenParser
{
+3 -6
View File
@@ -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.
*
*
* <pre>
* {% block head %}
* <link rel="stylesheet" href="style.css" />
* <title>{% block title %}{% endblock %} - My Webpage</title>
* {% endblock %}
* </pre>
*
*
*/
*/
class Twig_TokenParser_Block extends Twig_TokenParser
{
/**
+3 -8
View File
@@ -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.
*
*
* <pre>
* {% extends "base.html" %}
* </pre>
*
*
*/
*/
class Twig_TokenParser_Extends extends Twig_TokenParser
{
/**
+2 -5
View File
@@ -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.
*
*
* <pre>
* {% filter upper %}
* This text becomes uppercase
* {% endfilter %}
* </pre>
*
*
*/
class Twig_TokenParser_Filter extends Twig_TokenParser
{
+4 -7
View File
@@ -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.
*
*
* <pre>
* <ul>
* {% for user in users %}
* <li>{{ user.username|e }}</li>
* {% endfor %}
* </ul>
* </ul>
* </pre>
*
*
*/
*/
class Twig_TokenParser_For extends Twig_TokenParser
{
/**
+8
View File
@@ -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.
*
* <pre>
* {% from 'forms.html' import forms %}
* </pre>
*/
class Twig_TokenParser_From extends Twig_TokenParser
{
/**
+2 -4
View File
@@ -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.
*
* <pre>
* {% if users %}
@@ -22,8 +22,6 @@
* </ul>
* {% endif %}
* </pre>
*
*
*/
class Twig_TokenParser_If extends Twig_TokenParser
{
+2 -6
View File
@@ -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.
*
*
* <pre>
* {% import 'forms.html' as forms %}
* </pre>
*
*
*/
class Twig_TokenParser_Import extends Twig_TokenParser
{
+2 -5
View File
@@ -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.
*
*
* <pre>
* {% include 'header.html' %}
* Body
* {% include 'footer.html' %}
* </pre>
*
*
*/
class Twig_TokenParser_Include extends Twig_TokenParser
{
+2 -7
View File
@@ -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.
*
*
* <pre>
* {% macro input(name, value, type, size) %}
* <input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" />
* {% endmacro %}
* </pre>
*
*
*/
class Twig_TokenParser_Macro extends Twig_TokenParser
{
+2 -3
View File
@@ -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.
*
* <pre>
* {% sandbox %}
@@ -19,7 +19,6 @@
* </pre>
*
* @see http://www.twig-project.org/doc/api.html#sandbox-extension for details
*
*/
class Twig_TokenParser_Sandbox extends Twig_TokenParser
{
+3 -5
View File
@@ -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.
*
* <pre>
* {% set foo = 'foo' %}
*
@@ -25,8 +25,6 @@
*
* {% set foo %}Some content{% endset %}
* </pre>
*
*
*/
class Twig_TokenParser_Set extends Twig_TokenParser
{
+3 -3
View File
@@ -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.
*
* <pre>
* {% spaceless %}
@@ -17,10 +18,9 @@
* <strong>foo</strong>
* </div>
* {% endspaceless %}
*
*
* {# output will be <div><strong>foo</strong></div> #}
* </pre>
*
*/
class Twig_TokenParser_Spaceless extends Twig_TokenParser
{
+2 -1
View File
@@ -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 (its like macros, but for blocks):
* Imports blocks defined in another template into the current template.
*
* <pre>
* {% extends "base.html" %}