Fabien Potencier [Mon, 23 Apr 2012 18:08:03 +0000]
added more info in the docs
Fabien Potencier [Mon, 23 Apr 2012 11:03:38 +0000]
added the inline tag
Fabien Potencier [Sun, 22 Apr 2012 06:56:25 +0000]
fixed compatibility with PHP 5.2 and simplify code a bit
Fabien Potencier [Sat, 21 Apr 2012 20:21:04 +0000]
fixed template line number in some exceptions
Fabien Potencier [Sat, 21 Apr 2012 17:43:26 +0000]
added unit tests to prove the issue with the current introspection exception code
Fabien Potencier [Sat, 21 Apr 2012 13:46:19 +0000]
tweaked the iterable example in the docs
Fabien Potencier [Sat, 21 Apr 2012 05:33:50 +0000]
tweaked the iterable example in the docs
Fabien Potencier [Fri, 20 Apr 2012 18:17:16 +0000]
merged branch martinml/master (PR #705)
Commits
-------
3eecc60 Silence chmod() warnings (operation not permitted) when using CIFS mounts and possibly other cases.
Discussion
----------
Silence chmod() warnings (operation not permitted) when using CIFS
When using chmod() in a CIFS mount (NTFS) in Linux, Twig 1.6.5 in PHP 5.3.3 throws a warning:
Warning: chmod(): Operation not permitted in /smb/.../Twig/Environment.php on line 1052
There may be other combinations that trigger this warning. Related Symfony issue: https://github.com/symfony/symfony/issues/2125
Fabien Potencier [Fri, 20 Apr 2012 18:14:01 +0000]
fixed doc
Fabien Potencier [Fri, 20 Apr 2012 18:12:57 +0000]
updated CHANGELOG
Fabien Potencier [Fri, 20 Apr 2012 18:12:07 +0000]
removed the array test and rename the traversable test to iterable
Fabien Potencier [Fri, 20 Apr 2012 18:09:05 +0000]
merged branch Seldaek/isarray (PR #700)
Commits
-------
c88f8e5 Micro-optimizations
70cca66 Simplify code
d78ed66 Add traversable test
5fd2f98 Add docs
b2e1675 Add is array test
Discussion
----------
is array/traversable tests
It's sometimes necessary to display arbitrary data to be able to know if we should recurse or not.
---------------------------------------------------------------------------
by stof at 2012-04-13T12:13:11Z
I'm not sure about the need for ``is array``. All Twig functions related to arrays also support traversable objects
---------------------------------------------------------------------------
by Seldaek at 2012-04-13T12:23:32Z
Well, I like to have both for explicitness and also because I would try is array without looking at the docs, and I don't think it's right to make is array return true for traversables.
---------------------------------------------------------------------------
by fabpot at 2012-04-20T09:38:33Z
One of the main goal of Twig is to abstract the "real" type of the variables. We have already discussed the introduction of many tests like these ones and I have always rejected them.
As many people seems to have a need for them (especially for arrays), I would consider adding the `traversable` test. But as @stof said, Twig tries to blur the difference between traversable objects and arrays, so I'm -1 for adding another test for arrays.
`traversable` is probably not the best name for web designers but I don't know what else we can use here.
---------------------------------------------------------------------------
by stof at 2012-04-20T09:41:05Z
In Jinja, there is a built-in test for this using ``iterable``: http://jinja.pocoo.org/docs/templates/#builtin-tests
---------------------------------------------------------------------------
by Seldaek at 2012-04-20T09:41:32Z
Ok. I can live with dropping the array test. Now for the name, `is forloopable`? I am kind of at a loss as well apart from traversable. I think if it's clearly mentioned in the docs it's ok.
---------------------------------------------------------------------------
by Seldaek at 2012-04-20T09:52:12Z
iterable sounds ok to me, but just as confusing as traversable I guess to the unknowing. A sidenote, if I update the PR, any objection to adding the "undefined" test as well?
---------------------------------------------------------------------------
by fabpot at 2012-04-20T10:01:27Z
Let's use `iterable` as this is what Jinja already uses. Why would you want an `undefined` test as we already have `defined`? (`if foo is not defined` works well enough)
---------------------------------------------------------------------------
by Seldaek at 2012-04-20T11:16:26Z
I just saw jinja had it on that page, and I thought why not add it too? Still not a huge fan of the "not" for negation.
---------------------------------------------------------------------------
by fabpot at 2012-04-20T12:18:17Z
Well, let's first finish the `iterable` test first and let's discuss `undefined` in another PR or issue.
---------------------------------------------------------------------------
by fabpot at 2012-04-20T17:10:28Z
I can finish the PR is you want.
---------------------------------------------------------------------------
by Seldaek at 2012-04-20T17:13:11Z
If you like sure, it's mostly deleting code anyway. I just have to finish some work stuff now..
martinml [Fri, 20 Apr 2012 18:01:06 +0000]
Silence chmod() warnings (operation not permitted) when using CIFS mounts and possibly other cases.
Fabien Potencier [Fri, 20 Apr 2012 17:04:30 +0000]
renamed preserve_safety to preserves_safety to be consisten with needs_context and needs_environment
Fabien Potencier [Fri, 20 Apr 2012 17:02:27 +0000]
merged branch stof/preserve_safe (PR #684)
Commits
-------
0cbf5a0 Added an option to mark filters as preserving the safeness
Discussion
----------
Added an option to mark filters as preserving the safeness
Closes #678
I haven't written a test for this yet as I don't know how to provide a stub filter (as none of the core filters use this option) for the setup of the testsuite.
---------------------------------------------------------------------------
by fabpot at 2012-04-07T20:15:36Z
@stof: Can you also add some information in the phpdoc with an example so that people understand more easily when and why you would want to use this new option? Thanks.
---------------------------------------------------------------------------
by fabpot at 2012-04-07T20:16:36Z
Also, adding a unit test that demonstrates the bug you had in #678 would be good.
---------------------------------------------------------------------------
by stof at 2012-04-20T08:33:58Z
@fabpot none of the core filters are using this options, so what is the right way to add a test ?
---------------------------------------------------------------------------
by fabpot at 2012-04-20T08:36:26Z
by defining a filter in the test that uses it.
---------------------------------------------------------------------------
by stof at 2012-04-20T08:39:06Z
but is it possible to register a filter from the tests with the custom stuff used by Twig ?
---------------------------------------------------------------------------
by fabpot at 2012-04-20T08:48:06Z
in integrationTest.php, we already have quite a few functions and filters registered. I would just be a matter of adding a new one.
---------------------------------------------------------------------------
by stof at 2012-04-20T16:17:01Z
@fabpot renamed, tested and squashed
Christophe Coevoet [Fri, 20 Apr 2012 14:23:51 +0000]
Added an option to mark filters as preserving the safeness
Closes #678
Fabien Potencier [Fri, 20 Apr 2012 09:17:22 +0000]
added an error when defining two blocks with the same name in a template (closes #701)
Fabien Potencier [Fri, 20 Apr 2012 08:53:54 +0000]
added some missing tests for nested blocks
Fabien Potencier [Wed, 18 Apr 2012 05:19:25 +0000]
added a note in the documentation about what the C exension does
Fabien Potencier [Mon, 16 Apr 2012 07:04:57 +0000]
added missing parameters to Twig_Error_Syntax
Jordi Boggiano [Fri, 13 Apr 2012 13:48:00 +0000]
Micro-optimizations
Jordi Boggiano [Fri, 13 Apr 2012 12:22:03 +0000]
Simplify code
Jordi Boggiano [Fri, 13 Apr 2012 11:05:17 +0000]
Add traversable test
Jordi Boggiano [Fri, 13 Apr 2012 10:58:41 +0000]
Add docs
Jordi Boggiano [Fri, 13 Apr 2012 10:57:54 +0000]
Add is array test
Fabien Potencier [Thu, 12 Apr 2012 12:36:25 +0000]
fixed a PHP notice when trying to access a key on a non-object/array variable
Fabien Potencier [Wed, 11 Apr 2012 14:52:26 +0000]
updated CHANGELOG
Fabien Potencier [Mon, 9 Apr 2012 16:27:10 +0000]
merged branch Tobion/random-fix (PR #693)
Commits
-------
06361ca added note in changelog
2706412 fixed random function when charset is null
Discussion
----------
Fixed random function when charset is null
Fixed random function when charset is null and the value is an empty string, resulting in an mt_rand error max(-1) is smaller than min(0).
Also fixed a test on windows.
But I don't know why you introduced the special handling for `null === $env->getCharset()`.
Why is that necessary and why is it possible to have a null charset at all? Usually it defaults to utf-8 anyway.
Tobias Schultze [Mon, 9 Apr 2012 07:30:01 +0000]
added note in changelog
Tobias Schultze [Mon, 9 Apr 2012 07:26:53 +0000]
fixed random function when charset is null
Fabien Potencier [Sun, 8 Apr 2012 12:20:37 +0000]
merged branch igorw/composer (PR #691)
Commits
-------
72d3c19 [composer] Add branch alias for dev-master, adjust some other things
Discussion
----------
[composer] Add branch alias for dev-master, adjust some other things
* branch alias allows installation of dev-master by requiring 1.7.*, which is important since most packages depend on twig "<2.0.0"
* remove the version field, the version is determined by branch names and tags only
* change license to BSD-3, this is more explicit and the preferred format for BSD licenses
Fabien Potencier [Sun, 8 Apr 2012 12:12:00 +0000]
enhanced error reporting when the template file is an instance of SplFileInfo
Igor Wiedler [Sun, 8 Apr 2012 12:07:23 +0000]
[composer] Add branch alias for dev-master, adjust some other things
* branch alias allows installation of dev-master by requiring 1.7.*, which is important since most packages depend on twig "<2.0.0"
* remove the version field, the version is determined by branch names and tags only
* change license to BSD-3, this is more explicit and the preferred format for BSD licenses
Fabien Potencier [Sun, 8 Apr 2012 10:58:26 +0000]
added a tip in the doc
Fabien Potencier [Sat, 7 Apr 2012 20:40:59 +0000]
added a unit test to demonstrate the need to pass blocks when calling renderBlock|displayBlock
Fabien Potencier [Sat, 7 Apr 2012 16:15:20 +0000]
merged branch igorw/patch-1 (PR #689)
Commits
-------
11d4c6a [doc] Remove backticks in intro doc
Discussion
----------
[doc] Remove backticks in intro doc
Igor Wiedler [Sat, 7 Apr 2012 15:38:17 +0000]
[doc] Remove backticks in intro doc
Fabien Potencier [Sat, 7 Apr 2012 14:41:37 +0000]
merged branch markstory/loop-docs (PR #688)
Commits
-------
2a7102d Update docs concerning loop.last.
Discussion
----------
Update docs concerning loop.last.
Add docs for #687. `loop.last` is not defined when looping with conditions.
mark_story [Sat, 7 Apr 2012 13:50:44 +0000]
Update docs concerning loop.last.
Fabien Potencier [Thu, 5 Apr 2012 20:53:25 +0000]
added some more information about unknown variable/attributes in the doc (closes #685)
Fabien Potencier [Tue, 3 Apr 2012 17:13:43 +0000]
added Twig_Environment::mergeGlobals()
Fabien Potencier [Tue, 3 Apr 2012 17:12:14 +0000]
fixed a regression when a template only extends another one without defining any blocks (closes #683)
Fabien Potencier [Tue, 3 Apr 2012 07:56:57 +0000]
bumped version to 1.7.0-DEV
Fabien Potencier [Tue, 3 Apr 2012 07:45:11 +0000]
made usage of mergeContextWithGlobals in macros
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