mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-10 09:26:29 +00:00
removed the <pre> tag in docblocks
This commit is contained in:
@@ -356,9 +356,7 @@ function twig_random(Twig_Environment $env, $values = null)
|
||||
/**
|
||||
* Converts a date to the given format.
|
||||
*
|
||||
* <pre>
|
||||
* {{ post.published_at|date("m/d/Y") }}
|
||||
* </pre>
|
||||
*
|
||||
* @param Twig_Environment $env
|
||||
* @param DateTime|DateTimeInterface|DateInterval|string $date A date
|
||||
@@ -384,9 +382,7 @@ function twig_date_format_filter(Twig_Environment $env, $date, $format = null, $
|
||||
/**
|
||||
* Returns a new date object modified.
|
||||
*
|
||||
* <pre>
|
||||
* {{ post.published_at|date_modify("-1day")|date("m/d/Y") }}
|
||||
* </pre>
|
||||
*
|
||||
* @param Twig_Environment $env
|
||||
* @param DateTime|string $date A date
|
||||
@@ -408,11 +404,9 @@ function twig_date_modify_filter(Twig_Environment $env, $date, $modifier)
|
||||
/**
|
||||
* Converts an input to a DateTime instance.
|
||||
*
|
||||
* <pre>
|
||||
* {% if date(user.created_at) < date('+2days') %}
|
||||
* {# do something #}
|
||||
* {% endif %}
|
||||
* </pre>
|
||||
*
|
||||
* @param Twig_Environment $env
|
||||
* @param DateTime|DateTimeInterface|string|null $date A date
|
||||
@@ -591,13 +585,11 @@ function _twig_markup2string(&$value)
|
||||
/**
|
||||
* Merges an array with another one.
|
||||
*
|
||||
* <pre>
|
||||
* {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %}
|
||||
*
|
||||
* {% set items = items|merge({ 'peugeot': 'car' }) %}
|
||||
*
|
||||
* {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car' } #}
|
||||
* </pre>
|
||||
*
|
||||
* @param array|Traversable $arr1 An array
|
||||
* @param array|Traversable $arr2 An array
|
||||
@@ -698,7 +690,6 @@ function twig_last(Twig_Environment $env, $item)
|
||||
*
|
||||
* The separators between elements are empty strings per default, you can define them with the optional parameters.
|
||||
*
|
||||
* <pre>
|
||||
* {{ [1, 2, 3]|join(', ', ' and ') }}
|
||||
* {# returns 1, 2 and 3 #}
|
||||
*
|
||||
@@ -707,7 +698,6 @@ function twig_last(Twig_Environment $env, $item)
|
||||
*
|
||||
* {{ [1, 2, 3]|join }}
|
||||
* {# returns 123 #}
|
||||
* </pre>
|
||||
*
|
||||
* @param array $value An array
|
||||
* @param string $glue The separator
|
||||
@@ -742,7 +732,6 @@ function twig_join_filter($value, $glue = '', $and = null)
|
||||
/**
|
||||
* Splits the string into an array.
|
||||
*
|
||||
* <pre>
|
||||
* {{ "one,two,three"|split(',') }}
|
||||
* {# returns [one, two, three] #}
|
||||
*
|
||||
@@ -754,7 +743,6 @@ function twig_join_filter($value, $glue = '', $and = null)
|
||||
*
|
||||
* {{ "aabbcc"|split('', 2) }}
|
||||
* {# returns [aa, bb, cc] #}
|
||||
* </pre>
|
||||
*
|
||||
* @param Twig_Environment $env
|
||||
* @param string $value A string
|
||||
@@ -810,11 +798,9 @@ function _twig_default_filter($value, $default = '')
|
||||
*
|
||||
* It is useful when you want to iterate over the keys of an array:
|
||||
*
|
||||
* <pre>
|
||||
* {% for key in array|keys %}
|
||||
* {# ... #}
|
||||
* {% endfor %}
|
||||
* </pre>
|
||||
*
|
||||
* @param array $array An array
|
||||
*
|
||||
@@ -1450,12 +1436,10 @@ function twig_ensure_traversable($seq)
|
||||
/**
|
||||
* Checks if a variable is empty.
|
||||
*
|
||||
* <pre>
|
||||
* {# evaluates to true if the foo variable is null, false, or the empty string #}
|
||||
* {% if foo is empty %}
|
||||
* {# ... #}
|
||||
* {% endif %}
|
||||
* </pre>
|
||||
* {# evaluates to true if the foo variable is null, false, or the empty string #}
|
||||
* {% if foo is empty %}
|
||||
* {# ... #}
|
||||
* {% endif %}
|
||||
*
|
||||
* @param mixed $value A variable
|
||||
*
|
||||
@@ -1477,12 +1461,10 @@ function twig_test_empty($value)
|
||||
/**
|
||||
* Checks if a variable is traversable.
|
||||
*
|
||||
* <pre>
|
||||
* {# evaluates to true if the foo variable is an array or a traversable object #}
|
||||
* {% if foo is iterable %}
|
||||
* {# ... #}
|
||||
* {% endif %}
|
||||
* </pre>
|
||||
* {# evaluates to true if the foo variable is an array or a traversable object #}
|
||||
* {% if foo is iterable %}
|
||||
* {# ... #}
|
||||
* {% endif %}
|
||||
*
|
||||
* @param mixed $value A variable
|
||||
*
|
||||
|
||||
@@ -30,9 +30,7 @@ class Twig_Extension_StringLoader extends Twig_Extension
|
||||
/**
|
||||
* Loads a template from a string.
|
||||
*
|
||||
* <pre>
|
||||
* {{ include(template_from_string("Hello {{ name }}")) }}
|
||||
* </pre>
|
||||
* {{ include(template_from_string("Hello {{ name }}")) }}
|
||||
*
|
||||
* @param Twig_Environment $env A Twig_Environment instance
|
||||
* @param string $template A template as a string or object implementing __toString()
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
/**
|
||||
* Returns the value or the default value when it is undefined or empty.
|
||||
*
|
||||
* <pre>
|
||||
* {{ var.foo|default('foo item on var is not defined') }}
|
||||
* </pre>
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
|
||||
@@ -12,11 +12,9 @@
|
||||
/**
|
||||
* Checks if a variable is the exact same value as a constant.
|
||||
*
|
||||
* <pre>
|
||||
* {% if post.status is constant('Post::PUBLISHED') %}
|
||||
* the status attribute is exactly the same as Post::PUBLISHED
|
||||
* {% endif %}
|
||||
* </pre>
|
||||
* {% if post.status is constant('Post::PUBLISHED') %}
|
||||
* the status attribute is exactly the same as Post::PUBLISHED
|
||||
* {% endif %}
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
|
||||
@@ -12,12 +12,10 @@
|
||||
/**
|
||||
* Checks if a variable is defined in the current context.
|
||||
*
|
||||
* <pre>
|
||||
* {# defined works with variable names and variable attributes #}
|
||||
* {% if foo is defined %}
|
||||
* {# ... #}
|
||||
* {% endif %}
|
||||
* </pre>
|
||||
* {# defined works with variable names and variable attributes #}
|
||||
* {% if foo is defined %}
|
||||
* {# ... #}
|
||||
* {% endif %}
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
/**
|
||||
* Checks if a variable is divisible by a number.
|
||||
*
|
||||
* <pre>
|
||||
* {% if loop.index is divisible by(3) %}
|
||||
* </pre>
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
/**
|
||||
* Checks if a number is even.
|
||||
*
|
||||
* <pre>
|
||||
* {{ var is even }}
|
||||
* </pre>
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
/**
|
||||
* Checks that a variable is null.
|
||||
*
|
||||
* <pre>
|
||||
* {{ var is none }}
|
||||
* </pre>
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
/**
|
||||
* Checks if a number is odd.
|
||||
*
|
||||
* <pre>
|
||||
* {{ var is odd }}
|
||||
* </pre>
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
|
||||
@@ -12,20 +12,18 @@
|
||||
/**
|
||||
* Marks a section of a template to be escaped or not.
|
||||
*
|
||||
* <pre>
|
||||
* {% autoescape true %}
|
||||
* Everything will be automatically escaped in this block
|
||||
* {% endautoescape %}
|
||||
* {% autoescape true %}
|
||||
* Everything will be automatically escaped in this block
|
||||
* {% endautoescape %}
|
||||
*
|
||||
* {% autoescape false %}
|
||||
* Everything will be outputed as is in this block
|
||||
* {% endautoescape %}
|
||||
* {% autoescape false %}
|
||||
* Everything will be outputed as is in this block
|
||||
* {% endautoescape %}
|
||||
*
|
||||
* {% autoescape true js %}
|
||||
* Everything will be automatically escaped in this block
|
||||
* using the js escaping strategy
|
||||
* {% endautoescape %}
|
||||
* </pre>
|
||||
* {% autoescape true js %}
|
||||
* Everything will be automatically escaped in this block
|
||||
* using the js escaping strategy
|
||||
* {% endautoescape %}
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
|
||||
@@ -13,12 +13,10 @@
|
||||
/**
|
||||
* 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>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
|
||||
@@ -12,11 +12,8 @@
|
||||
/**
|
||||
* Deprecates a section of a template.
|
||||
*
|
||||
* <pre>
|
||||
* {% deprecated 'The "base.twig" template is deprecated, use "layout.twig" instead.' %}
|
||||
*
|
||||
* {% extends 'layout.html.twig' %}
|
||||
* </pre>
|
||||
* {% deprecated 'The "base.twig" template is deprecated, use "layout.twig" instead.' %}
|
||||
* {% extends 'layout.html.twig' %}
|
||||
*
|
||||
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
||||
*
|
||||
|
||||
@@ -13,9 +13,7 @@
|
||||
/**
|
||||
* Extends a template by another one.
|
||||
*
|
||||
* <pre>
|
||||
* {% extends "base.html" %}
|
||||
* </pre>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
|
||||
@@ -12,11 +12,9 @@
|
||||
/**
|
||||
* Filters a section of a template by applying filters.
|
||||
*
|
||||
* <pre>
|
||||
* {% filter upper %}
|
||||
* This text becomes uppercase
|
||||
* {% endfilter %}
|
||||
* </pre>
|
||||
* {% filter upper %}
|
||||
* This text becomes uppercase
|
||||
* {% endfilter %}
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
|
||||
@@ -13,13 +13,11 @@
|
||||
/**
|
||||
* Loops over each item of a sequence.
|
||||
*
|
||||
* <pre>
|
||||
* <ul>
|
||||
* {% for user in users %}
|
||||
* <li>{{ user.username|e }}</li>
|
||||
* {% endfor %}
|
||||
* </ul>
|
||||
* </pre>
|
||||
* <ul>
|
||||
* {% for user in users %}
|
||||
* <li>{{ user.username|e }}</li>
|
||||
* {% endfor %}
|
||||
* </ul>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
/**
|
||||
* Imports macros.
|
||||
*
|
||||
* <pre>
|
||||
* {% from 'forms.html' import forms %}
|
||||
* </pre>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
|
||||
@@ -13,15 +13,13 @@
|
||||
/**
|
||||
* Tests a condition.
|
||||
*
|
||||
* <pre>
|
||||
* {% if users %}
|
||||
* <ul>
|
||||
* {% for user in users %}
|
||||
* <li>{{ user.username|e }}</li>
|
||||
* {% endfor %}
|
||||
* </ul>
|
||||
* {% endif %}
|
||||
* </pre>
|
||||
* {% if users %}
|
||||
* <ul>
|
||||
* {% for user in users %}
|
||||
* <li>{{ user.username|e }}</li>
|
||||
* {% endfor %}
|
||||
* </ul>
|
||||
* {% endif %}
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
/**
|
||||
* Imports macros.
|
||||
*
|
||||
* <pre>
|
||||
* {% import 'forms.html' as forms %}
|
||||
* </pre>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
|
||||
@@ -13,11 +13,9 @@
|
||||
/**
|
||||
* Includes a template.
|
||||
*
|
||||
* <pre>
|
||||
* {% include 'header.html' %}
|
||||
* Body
|
||||
* {% include 'footer.html' %}
|
||||
* </pre>
|
||||
*/
|
||||
class Twig_TokenParser_Include extends Twig_TokenParser
|
||||
{
|
||||
|
||||
@@ -12,11 +12,9 @@
|
||||
/**
|
||||
* 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>
|
||||
* {% macro input(name, value, type, size) %}
|
||||
* <input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" />
|
||||
* {% endmacro %}
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
|
||||
@@ -12,11 +12,9 @@
|
||||
/**
|
||||
* Marks a section of a template as untrusted code that must be evaluated in the sandbox mode.
|
||||
*
|
||||
* <pre>
|
||||
* {% sandbox %}
|
||||
* {% include 'user.html' %}
|
||||
* {% endsandbox %}
|
||||
* </pre>
|
||||
* {% sandbox %}
|
||||
* {% include 'user.html' %}
|
||||
* {% endsandbox %}
|
||||
*
|
||||
* @see https://twig.symfony.com/doc/api.html#sandbox-extension for details
|
||||
*
|
||||
|
||||
@@ -12,19 +12,12 @@
|
||||
/**
|
||||
* Defines a variable.
|
||||
*
|
||||
* <pre>
|
||||
* {% set foo = 'foo' %}
|
||||
*
|
||||
* {% set foo = [1, 2] %}
|
||||
*
|
||||
* {% set foo = {'foo': 'bar'} %}
|
||||
*
|
||||
* {% set foo = 'foo' ~ 'bar' %}
|
||||
*
|
||||
* {% set foo, bar = 'foo', 'bar' %}
|
||||
*
|
||||
* {% set foo %}Some content{% endset %}
|
||||
* </pre>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
|
||||
@@ -12,15 +12,12 @@
|
||||
/**
|
||||
* Remove whitespaces between HTML tags.
|
||||
*
|
||||
* <pre>
|
||||
* {% spaceless %}
|
||||
* {% spaceless %}
|
||||
* <div>
|
||||
* <strong>foo</strong>
|
||||
* </div>
|
||||
* {% endspaceless %}
|
||||
*
|
||||
* {# output will be <div><strong>foo</strong></div> #}
|
||||
* </pre>
|
||||
* {% endspaceless %}
|
||||
* {# output will be <div><strong>foo</strong></div> #}
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
|
||||
@@ -12,14 +12,12 @@
|
||||
/**
|
||||
* Imports blocks defined in another template into the current template.
|
||||
*
|
||||
* <pre>
|
||||
* {% extends "base.html" %}
|
||||
* {% extends "base.html" %}
|
||||
*
|
||||
* {% use "blocks.html" %}
|
||||
* {% use "blocks.html" %}
|
||||
*
|
||||
* {% block title %}{% endblock %}
|
||||
* {% block content %}{% endblock %}
|
||||
* </pre>
|
||||
* {% block title %}{% endblock %}
|
||||
* {% block content %}{% endblock %}
|
||||
*
|
||||
* @see https://twig.symfony.com/doc/templates.html#horizontal-reuse for details.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user