Fabien Potencier [Tue, 3 Apr 2012 07:10:53 +0000]
fixed doc markup
Fabien Potencier [Tue, 3 Apr 2012 07:08:32 +0000]
fixed doc markup
Fabien Potencier [Tue, 3 Apr 2012 07:07:53 +0000]
fixed doc indexes
Fabien Potencier [Tue, 3 Apr 2012 07:07:04 +0000]
renamed a test
Fabien Potencier [Tue, 3 Apr 2012 07:03:41 +0000]
added compilation checks to avoid misuses of the sandbox tag
Fabien Potencier [Tue, 3 Apr 2012 06:59:31 +0000]
fixed Twig unit tests when a template must throw an exception
Fabien Potencier [Tue, 3 Apr 2012 06:49:35 +0000]
enhance error reporting in Twig unit tests
Fabien Potencier [Tue, 3 Apr 2012 06:08:55 +0000]
added doc for the sandbox tag
Fabien Potencier [Tue, 3 Apr 2012 05:32:06 +0000]
added a note about sandbox policy checks in the doc (refs #677)
Fabien Potencier [Tue, 3 Apr 2012 05:20:03 +0000]
fixed filesystem loader freshness logic for high traffic websites (closes #682)
Fabien Potencier [Mon, 2 Apr 2012 17:45:40 +0000]
bumped version to 1.6.4-DEV
Fabien Potencier [Mon, 2 Apr 2012 17:42:18 +0000]
prepared the 1.6.4 release
Fabien Potencier [Sun, 1 Apr 2012 08:25:37 +0000]
updated CHANGELOG
Fabien Potencier [Sun, 1 Apr 2012 08:24:05 +0000]
fixed file permission
Fabien Potencier [Sun, 1 Apr 2012 08:22:57 +0000]
merged branch Nami-Doc/patch-1 (PR #680)
Commits
-------
27ffef0 The question I'm asking myself now is : how could I get $trace['line'] is not set if there's a check before the <= ? anyway, fixed
36618fe fix a bug where when an error would be thrown through the loader (Twig_Error_Loader by Twig_Loader_Filesystem, ie) the $trace['line'] would not be set (since we're not in a template)
Discussion
----------
fix a bug where when an error would be thrown through the loader
(Twig_Error_Loader by Twig_Loader_Filesystem, ie) the $trace['line'] would not be set (since we're not in a template)
thanks
---------------------------------------------------------------------------
by Nami-Doc at 2012-03-31T20:00:31Z
fixed, thanks @stof. Now I wonder (as I just wrote) : how could I get the error with that isset here ?
---------------------------------------------------------------------------
by stof at 2012-03-31T20:05:45Z
@Nami-Doc what was the exact error you got ?
---------------------------------------------------------------------------
by Nami-Doc at 2012-03-31T20:09:51Z
Php states that $trace['line'] isn't set
---------------------------------------------------------------------------
by Nami-Doc at 2012-03-31T20:23:33Z
O.K., got it. this has been fixed in #675, but composer (great tool) installed me last tag, but I think it's better to check it outside the loop anyway (micro-micro-optimisation)
Fabien Potencier [Sun, 1 Apr 2012 08:03:24 +0000]
fixed performance when compiling large files
Nami-Doc [Sat, 31 Mar 2012 19:59:45 +0000]
The question I'm asking myself now is : how could I get $trace['line'] is not set if there's a check before the <= ? anyway, fixed
Nami-Doc [Sat, 31 Mar 2012 16:45:34 +0000]
fix a bug where when an error would be thrown through the loader (Twig_Error_Loader by Twig_Loader_Filesystem, ie) the $trace['line'] would not be set (since we're not in a template)
Fabien Potencier [Sat, 31 Mar 2012 13:26:42 +0000]
made a small optimization when there is only one trait used in a template
Fabien Potencier [Fri, 30 Mar 2012 19:05:14 +0000]
optimized parent template creation when the template does not use dynamic inheritance
Fabien Potencier [Fri, 23 Mar 2012 23:23:13 +0000]
merged branch lyrixx/error-guess (PR #675)
Commits
-------
d0ae029 Fixed notice in Twig_Error::guessTemplateLine
Discussion
----------
Fixed notice in Twig_Error::guessTemplateLine
Sometimes, `trace['line']` is not available and makes notice.
You can see tests in https://github.com/lyrixx/Silex-Kitchen-Edition/tree/composer.
Grégoire Pineau [Fri, 23 Mar 2012 22:59:21 +0000]
Fixed notice in Twig_Error::guessTemplateLine
Fabien Potencier [Thu, 22 Mar 2012 18:43:11 +0000]
merged branch carbonatethis/Documentation (PR #674)
Commits
-------
bf0cc53 Added code snippet to documentation to describe handling null values with date filter
Discussion
----------
Date filter docs update
Added code snippet to documentation to describe handling null values with date filter
cb [Thu, 22 Mar 2012 18:12:09 +0000]
Added code snippet to documentation to describe handling null values with date filter
Fabien Potencier [Thu, 22 Mar 2012 17:31:45 +0000]
bumped version to 1.6.4-DEV
Fabien Potencier [Thu, 22 Mar 2012 17:28:15 +0000]
prepared the 1.6.3 release
Fabien Potencier [Thu, 22 Mar 2012 13:34:27 +0000]
added documentation for the trim filter
Fabien Potencier [Thu, 22 Mar 2012 13:25:00 +0000]
fixed usage of Z_ADDREF_P for PHP 5.2 in the C extension
Fabien Potencier [Mon, 19 Mar 2012 18:52:05 +0000]
merged branch shieldo/patch-1 (PR #670)
Commits
-------
7f0cca0 fixed incorrect docblock
Discussion
----------
fixed incorrect docblock
---------------------------------------------------------------------------
by shieldo at 2012-03-19T18:15:41Z
True, and done.
---------------------------------------------------------------------------
by fabpot at 2012-03-19T18:19:33Z
Can you rebase your PR and squash your commits so that we don't have the merge? Thanks.
---------------------------------------------------------------------------
by shieldo at 2012-03-19T18:43:28Z
Sorry about that. Done. :)
Fabien Potencier [Mon, 19 Mar 2012 18:17:36 +0000]
simplified code
Douglas Greenshields [Mon, 19 Mar 2012 17:38:45 +0000]
fixed incorrect docblock
Fabien Potencier [Sun, 18 Mar 2012 23:08:15 +0000]
fixed compilation of numeric values used in templates when using a locale where the decimal separator is not a dot
Fabien Potencier [Sat, 17 Mar 2012 17:48:06 +0000]
simplified tests
Fabien Potencier [Sat, 17 Mar 2012 17:12:19 +0000]
made the strategy used to guess the real template file name and line number in exception messages much faster and more accurate (refs #647)
Fabien Potencier [Sun, 18 Mar 2012 02:33:04 +0000]
bumped version to 1.7.0-DEV
Fabien Potencier [Sun, 18 Mar 2012 02:23:00 +0000]
prepared the 1.6.2 release
Fabien Potencier [Sat, 17 Mar 2012 12:51:26 +0000]
fixed sandbox mode when used with inheritance (closes #656)
The checkSecurity() method must be called by each template as we are not
using inheritance.
Fabien Potencier [Sat, 17 Mar 2012 11:42:06 +0000]
added preserveKeys support for the slice filter (closes #669)
Fabien Potencier [Thu, 15 Mar 2012 16:24:51 +0000]
fixed the date filter when a DateTime instance is passed with a specific timezone (closes #660)
Fabien Potencier [Thu, 15 Mar 2012 06:25:00 +0000]
merged branch stof/trim_filter (PR #662)
Commits
-------
d942d11 Added a trim filter
Discussion
----------
Added a trim filter
This adds a trim filter in Twig as most people thought it deserves being in the core rather than in the extensions.
Closes #634
---------------------------------------------------------------------------
by fabpot at 2012-03-13T16:47:15Z
I would have added a second option to control whether you trim on both side, only on the left, or only the right. What do you think?
---------------------------------------------------------------------------
by nikic at 2012-03-13T17:15:43Z
@fabpot In that case I'd rather add two additional functions `trim_left` (mapping to `ltrim`) and `trim_right` (mapping to `rtrim`). Should be more obvious than some flag at the end :)
---------------------------------------------------------------------------
by stof at 2012-03-13T18:47:38Z
I tend to think that separate filters would indeed be more obvious. What do you prefer @fabpot ?
And for the flag, how would you specify the option to use ? Using a string ? Using boolean flags is not appropriate here (as we have 3 meaningful cases) and I don't really like the string solution.
---------------------------------------------------------------------------
by fabpot at 2012-03-13T18:53:08Z
I don't like the idea of having 3 different filter just for trimming. That seems overkill to me.
---------------------------------------------------------------------------
by stof at 2012-03-13T19:14:12Z
which API do you suggest for the filter then ?
---------------------------------------------------------------------------
by fabpot at 2012-03-13T19:23:51Z
I've no definitive idea. So, perhaps we can just merge what you've done for now.
---------------------------------------------------------------------------
by Koc at 2012-03-13T20:17:17Z
+1 for merge this. There are different filters for different trimming.
I cannot remember but there are some situations when we got string with whitespaces in variable and `{{- my_variable -}}` couldn't help and we cann't use `spaceless` filter because `my_vaiable` contains not html for example.
upd: oh, sorry, I haven't noticed comment from @nikic .
---------------------------------------------------------------------------
by Tobion at 2012-03-13T21:05:09Z
I suggest `function trim($left = true, $right = true)` but `left` and `right` could also be strings.
That would cover all cases.
---------------------------------------------------------------------------
by raulfraile at 2012-03-13T23:43:28Z
I think 3 different filters would be much clearer than using string/boolean parameters. IMO is the same case than strtolower/strtoupper.
Fabien Potencier [Tue, 13 Mar 2012 16:44:20 +0000]
merged branch raulfraile/patch-1 (PR #665)
Commits
-------
0519419 Updated 'convert_encoding' filter documentation
Discussion
----------
Updated 'convert_encoding' filter documentation
Updated 'convert_encoding' filter documentation to clarify which extension will be used in case both `iconv` and `mbstring` are installed.
Raul Fraile [Tue, 13 Mar 2012 16:33:49 +0000]
Updated 'convert_encoding' filter documentation
Christophe Coevoet [Mon, 12 Mar 2012 13:56:44 +0000]
Added a trim filter
Closes #634
Fabien Potencier [Sat, 10 Mar 2012 18:52:41 +0000]
merged branch andrerom/patch-1 (PR #658)
Commits
-------
be07174 Added @return doc on Twig_LoaderInterface->isFresh()
8315992 Added missing @throws in Twig_LoaderInterface
Discussion
----------
Added missing @throws in Twig_LoaderInterface
Based on Twig_Loader_Chain implementation, this seems to be the possible exception that can be thrown by loaders.
andrerom [Sat, 10 Mar 2012 15:58:52 +0000]
Added @return doc on Twig_LoaderInterface->isFresh()
andrerom [Sat, 10 Mar 2012 15:39:02 +0000]
Added missing @throws in Twig_LoaderInterface
Based on Twig_Loader_Chain implementation, this seems to be the possible exceptions that can be thrown by loaders.
Fabien Potencier [Thu, 1 Mar 2012 14:11:11 +0000]
fixed typo
Fabien Potencier [Wed, 29 Feb 2012 21:20:34 +0000]
fixed previous commit
Fabien Potencier [Wed, 29 Feb 2012 21:18:38 +0000]
merged branch robo47/docs-install-via-composer (PR #648)
Commits
-------
7153ff6 Installing twig via composer
Discussion
----------
Installing twig via composer
Installing twig via composer
Fabien Potencier [Wed, 29 Feb 2012 21:10:49 +0000]
bumped Twig version
Fabien Potencier [Wed, 29 Feb 2012 21:02:48 +0000]
fixed typo in the doc
Fabien Potencier [Wed, 29 Feb 2012 21:00:20 +0000]
fixed typos in the doc
Fabien Potencier [Wed, 29 Feb 2012 20:46:35 +0000]
prepared the 1.6.1 release
Fabien Potencier [Tue, 28 Feb 2012 22:09:42 +0000]
fixed Twig C extension
Fabien Potencier [Tue, 28 Feb 2012 20:47:03 +0000]
fixed CS
Fabien Potencier [Tue, 28 Feb 2012 20:36:27 +0000]
added some unit tests
Benjamin Steininger [Mon, 27 Feb 2012 10:10:31 +0000]
Installing twig via composer
Fabien Potencier [Tue, 21 Feb 2012 10:44:24 +0000]
added some more information on the spaceless tag documentation
Fabien Potencier [Sun, 19 Feb 2012 10:09:47 +0000]
added some information about Twig_Template::getContext() and made it final
Fabien Potencier [Sun, 19 Feb 2012 10:03:22 +0000]
Revert "merged branch m0ppers/master (PR #611)"
This reverts commit
5f4e6d7a0eae30791e9e1433c90b157bcb5dc8f7, reversing
changes made to
a61d42084caeadc4cc8c3bd1caded87631c12636.
Fabien Potencier [Sat, 18 Feb 2012 09:35:52 +0000]
updated CHANGELOG
Fabien Potencier [Sat, 18 Feb 2012 09:18:43 +0000]
merged branch m0ppers/master (PR #611)
Commits
-------
71449e8 Remove optimization (covered by Optimization VAR_ACCESS anyway)
Discussion
----------
Remove optimization (covered by Optimization VAR_ACCESS anyway)
I have an own template class implementing getContext() and this one drove me completely mad after a twig upgrade.
After compilation the resulting templates have:
isset($context['bla'])
vs.
$this->getContext('bla')
Changing the Name Node however didn't have any effect and i saw that due to the optimizations by the SetTemp class twig doesn't even reach the Name Node. In fact SetTemp has the isset optimization hardcoded (which is ok).
I could simply fix my issue by setting optimizations to -9 (all optimizations except VAR_ACCESS). However the issue will reappear immediately when using PHP 5.4. Please remove the isset stuff from the non optimized node and let the optimization handler handle it (which i would disable in my case)
---------------------------------------------------------------------------
by m0ppers at 2012-01-24T17:42:07Z
some hackish script to test what i mean
<?php
require 'lib/Twig/Autoloader.php';
Twig_Autoloader::register();
abstract class Harxtemplate extends Twig_Template
{
public function getContext($context, $item, $ignoreStrictCheck = false)
{
if ($item == "hans") {
return "hund";
} else {
return parent::getContext($context, $item, $ignorStrictCheck);
}
}
}
$template = <<<EOT
Der {{ hans }} hat hund
{% if hans %}
hund
{% endif %}
EOT;
$loader = new Twig_Loader_String();
$options = array('base_template_class' => 'Harxtemplate',
// 'strict_variables' => true, // doesn't work
'debug' => true,
'optimizations' => -1, // 0 => works
);
$twig = new Twig_Environment($loader, $options);
echo $twig->render($template);
Fabien Potencier [Sat, 18 Feb 2012 09:05:10 +0000]
clarified documentation (closes #602)
Fabien Potencier [Sat, 18 Feb 2012 09:00:52 +0000]
merged branch mvrhov/patch-1 (PR #603)
Commits
-------
95f8af7 cast $name to a string as $name can in fact be an object implementing __toString function as true in my case.
Discussion
----------
cast $name to a string ...
... because $name can be an object implementing __toString. I have Enum type implementation which implements __toString. Without the cast I'm getting the following exception:
"An exception has been thrown during the rendering of a template ("Warning: Illegal offset type in isset or empty in... "
---------------------------------------------------------------------------
by fabpot at 2012-01-18T08:43:23Z
From where do you call these methods? from your code? from a template?
---------------------------------------------------------------------------
by mvrhov at 2012-01-18T11:17:55Z
I put the enum object as variable into the template and then based on the enum value I display a block.
Fabien Potencier [Sat, 18 Feb 2012 08:55:38 +0000]
updated CHANGELOG
Fabien Potencier [Sat, 18 Feb 2012 08:54:30 +0000]
merged branch Seldaek/markup (PR #638)
Commits
-------
e4590d0 Avoid creating unnecessary Twig_Markup instances, allows testing for falsiness of empty output
Discussion
----------
Avoid creating unnecessary Twig_Markup instances
This allows testing for falsiness of an empty output:
```jinja
{% set foo %}{% block lala %}{% endblock %}{% endset %}
{% if foo %}
some output with {{ foo }}
{% endif %}
```
Currently this requires `{% if foo|length %}` since the set tag will always return a Twig_Markup.
Jordi Boggiano [Fri, 17 Feb 2012 14:56:34 +0000]
Avoid creating unnecessary Twig_Markup instances, allows testing for falsiness of empty output
Fabien Potencier [Fri, 17 Feb 2012 13:16:13 +0000]
added phpdoc (closes #627)
Fabien Potencier [Wed, 15 Feb 2012 16:27:33 +0000]
updated the CHANGELOG and documentation for previous merge
Fabien Potencier [Wed, 15 Feb 2012 16:24:22 +0000]
fixed previous merge
Fabien Potencier [Wed, 15 Feb 2012 16:21:29 +0000]
merged branch mlehner/default_timezone (PR #635)
Commits
-------
5699753 added setTimezone to allow globally overriding the timezone when formating dates
Discussion
----------
Allow setting global timezone for date formatting
My API returns dates in a string format of 2012-02-14T00:35:37+00:00. When parsed by the DateTime constructor, the timezone for that new object is UTC. Without specifying every time I use the date filter there was no way to globally influence the timezone used.
I added setTimezone() to the core extension that functions similar to setDateFormat() except that there is no timezone set by default to allow for backwards compatibility.
Matt Lehner [Tue, 14 Feb 2012 19:52:51 +0000]
added setTimezone to allow globally overriding the timezone when formating dates
Fabien Potencier [Sun, 12 Feb 2012 19:28:11 +0000]
merged branch webwizard/patch-1 (PR #628)
Commits
-------
904dfef fixed typo
Discussion
----------
fixed typo
Victor Zamfir [Sun, 12 Feb 2012 19:10:01 +0000]
fixed typo
Fabien Potencier [Mon, 6 Feb 2012 17:16:12 +0000]
removed usage of assertInstanceOf as if is not available when using PHPUnit on PHP 5.2.*
Fabien Potencier [Mon, 6 Feb 2012 15:21:45 +0000]
added more safeguards in unit tests to support different configuraitons
Fabien Potencier [Mon, 6 Feb 2012 09:05:54 +0000]
updated CHANGELOG
Fabien Potencier [Mon, 6 Feb 2012 09:03:50 +0000]
added some unit tests for previous merge
Fabien Potencier [Mon, 6 Feb 2012 08:58:57 +0000]
fixes CS
Fabien Potencier [Mon, 6 Feb 2012 08:58:24 +0000]
merged branch sv1l/master (PR #623)
Commits
-------
b6007f1 Fixed slice filter w/ null length for string values
Discussion
----------
Fixed issue #622: strings slice filter w/ no length
Fixed issue [#622](https://github.com/fabpot/Twig/issues/622)
Sylvain Dethier [Sun, 5 Feb 2012 17:37:26 +0000]
Fixed slice filter w/ null length for string values
Fabien Potencier [Sat, 4 Feb 2012 08:38:23 +0000]
fixed the creation of the cache directory in case of a race condition (closes #620)
Fabien Potencier [Sat, 4 Feb 2012 07:38:18 +0000]
bumped version to 1.7.0-DEV
Fabien Potencier [Sat, 4 Feb 2012 07:34:52 +0000]
prepared the 1.6.0 release
Fabien Potencier [Tue, 31 Jan 2012 10:57:59 +0000]
added missing entry in the doc
Fabien Potencier [Sat, 28 Jan 2012 16:45:32 +0000]
fixed raw blocks when used with the whitespace trim option (closes #617)
Fabien Potencier [Sat, 28 Jan 2012 16:12:21 +0000]
added some unit tests for the reverse filter when charset is not UTF-8
Fabien Potencier [Sat, 28 Jan 2012 16:09:25 +0000]
added some unit tests for random() when charset is not UTF-8
Fabien Potencier [Sat, 28 Jan 2012 15:58:52 +0000]
fixed previous commit
Fabien Potencier [Fri, 27 Jan 2012 07:24:59 +0000]
fixed the random() function on strings when the charset is not UTF-8
(refs #614)
Fabien Potencier [Thu, 26 Jan 2012 14:06:15 +0000]
fixed CS
Fabien Potencier [Thu, 26 Jan 2012 14:06:02 +0000]
merged branch Tobion/test-coverage (PR #615)
Commits
-------
814cefd improve test coverage and support negative int for random function
Discussion
----------
improve test coverage and support negative int for random function
Tobias Schultze [Thu, 26 Jan 2012 13:52:41 +0000]
improve test coverage and support negative int for random function
Fabien Potencier [Thu, 26 Jan 2012 12:25:31 +0000]
tweaked doc
Fabien Potencier [Thu, 26 Jan 2012 12:24:26 +0000]
merged branch Tobion/patch-4 (PR #614)
Commits
-------
a15e8f7 typo again
2561aa2 typo
faa90c9 updated doc for random function
fe66358 added tests for random function
6f5ceee Made the random function more versatile
Discussion
----------
Made the random function more versatile
The point is to meet user expectations and to make it more versatile, so it works under more circumstances.
At the moment the random function does only return the supplied parameter when it's not an array. That is not very useful. With this PR it will behave like
random() => integer as with mt_rand()
random(5) => integer between 0 and 5 as with mt_rand(0, 5)
random('foobar') => random character from 'foobar'
random(array(...)) => random element
I will add tests and documentation if you accept this PR.
---------------------------------------------------------------------------
by fabpot at 2012-01-26T07:29:35Z
Looks good to me. Can you update the docs and add some unit tests?
---------------------------------------------------------------------------
by Tobion at 2012-01-26T11:50:17Z
ready
Tobias Schultze [Thu, 26 Jan 2012 11:48:56 +0000]
typo again
Tobias Schultze [Thu, 26 Jan 2012 11:48:04 +0000]
typo
Tobias Schultze [Thu, 26 Jan 2012 11:45:18 +0000]
updated doc for random function
Tobias Schultze [Thu, 26 Jan 2012 11:19:51 +0000]
added tests for random function
Tobias Schultze [Thu, 26 Jan 2012 01:32:02 +0000]
Made the random function more versatile