Made document editing possible

This commit is contained in:
Polonkai Gergely
2012-07-22 19:38:00 +02:00
parent 1b55b079f4
commit b82b4ffd34
136 changed files with 2734 additions and 1289 deletions

View File

@@ -1,6 +1,7 @@
* 1.9.1 (2012-XX-XX)
* n/a
* fixed wrong parent class for Twig_Function_Node
* made Twig_Loader_Chain more explicit about problems
* 1.9.0 (2012-07-13)

View File

@@ -16,7 +16,7 @@ separator using the additional arguments:
.. code-block:: jinja
{{ 9800.333|number_format(2, ',', '.') }}
{{ 9800.333|number_format(2, '.', ',') }}
If no formatting options are provided then Twig will use the default formatting
options of:
@@ -30,7 +30,7 @@ These defaults can be easily changed through the core extension:
.. code-block:: php
$twig = new Twig_Environment($loader);
$twig->getExtension('core')->setNumberFormat(3, ',', '.');
$twig->getExtension('core')->setNumberFormat(3, '.', ',');
The defaults set for ``number_format`` can be over-ridden upon each call using the
additional parameters.

View File

@@ -328,7 +328,7 @@ you have some dynamic JavaScript files thanks to the ``autoescape`` tag:
.. code-block:: jinja
{% autoescape js %}
{% autoescape 'js' %}
... some JS ...
{% endautoescape %}

View File

@@ -74,6 +74,15 @@ properties of a PHP object, or items of a PHP array), or the so-called
{{ foo.bar }}
{{ foo['bar'] }}
When the attribute contains special characters (like ``-`` that would be
interpreted as the minus operator), use the ``attribute`` function instead to
access the variable attribute:
.. code-block:: jinja
{# equivalent to the non-working foo.data-foo #}
{{ attribute(foo, 'data-foo') }}
.. note::
It's important to know that the curly braces are *not* part of the

View File

@@ -5,7 +5,7 @@
.. code-block:: jinja
{# evaluates to true if the foo variable is null, false, or the empty string #}
{# evaluates to true if the foo variable is null, false, an empty array, or the empty string #}
{% if foo is empty %}
...
{% endif %}

View File

@@ -17,7 +17,7 @@ class Twig_Extension_Debug extends Twig_Extension
*/
public function getFunctions()
{
// dump is safe if var_dump is overriden by xdebug
// dump is safe if var_dump is overridden by xdebug
$isDumpOutputHtmlSafe = extension_loaded('xdebug')
// false means that it was not set (and the default is on) or it explicitly enabled
&& (false === ini_get('xdebug.overload_var_dump') || ini_get('xdebug.overload_var_dump'))

View File

@@ -51,14 +51,16 @@ class Twig_Loader_Chain implements Twig_LoaderInterface
*/
public function getSource($name)
{
$exceptions = array();
foreach ($this->loaders as $loader) {
try {
return $loader->getSource($name);
} catch (Twig_Error_Loader $e) {
$exceptions[] = $e->getMessage();
}
}
throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name));
throw new Twig_Error_Loader(sprintf('Template "%s" is not defined (%s).', $name, implode(', ', $exceptions)));
}
/**
@@ -70,14 +72,16 @@ class Twig_Loader_Chain implements Twig_LoaderInterface
*/
public function getCacheKey($name)
{
$exceptions = array();
foreach ($this->loaders as $loader) {
try {
return $loader->getCacheKey($name);
} catch (Twig_Error_Loader $e) {
$exceptions[] = get_class($loader).': '.$e->getMessage();
}
}
throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name));
throw new Twig_Error_Loader(sprintf('Template "%s" is not defined (%s).', $name, implode(' ', $exceptions)));
}
/**
@@ -88,13 +92,15 @@ class Twig_Loader_Chain implements Twig_LoaderInterface
*/
public function isFresh($name, $time)
{
$exceptions = array();
foreach ($this->loaders as $loader) {
try {
return $loader->isFresh($name, $time);
} catch (Twig_Error_Loader $e) {
$exceptions[] = get_class($loader).': '.$e->getMessage();
}
}
throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name));
throw new Twig_Error_Loader(sprintf('Template "%s" is not defined (%s).', $name, implode(' ', $exceptions)));
}
}

View File

@@ -284,7 +284,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
* This method is for internal use only and should never be called
* directly.
*
* This method should not be overriden in a sub-class as this is an
* This method should not be overridden in a sub-class as this is an
* implementation detail that has been introduced to optimize variable
* access for versions of PHP before 5.4. This is not a way to override
* the way to get a variable value.

View File

@@ -22,10 +22,6 @@ class Twig_Test_EscapingTest extends PHPUnit_Framework_TestCase
protected $htmlAttrSpecialChars = array(
'\'' => ''',
'"' => '"',
'<' => '&lt;',
'>' => '&gt;',
'&' => '&amp;',
/* Characters beyond ASCII value 255 to unicode escape */
'Ā' => '&#x0100;',
/* Immune chars excluded */