Commit Graph

937 Commits

Author SHA1 Message Date
Fabien Potencier c2371dbbd6 migrated most tests to proper Node classes 2011-11-01 08:57:26 +01:00
Fabien Potencier c749c6b822 moved the defined test to a Twig_Test_Node class 2011-11-01 08:50:39 +01:00
Fabien Potencier b1d06ccbc9 added Twig_Test_Node to allow more complex tests to have their own Node class (sameas has been converted as an example) 2011-11-01 08:50:36 +01:00
Fabien Potencier 083d839000 added a better error message when a template is empty but contain a BOM 2011-10-31 18:49:47 +01:00
Fabien Potencier f5adcb6970 optimized tokenizer by pre-computing all start tag positions (memory and CPU) 2011-10-31 18:03:41 +01:00
Fabien Potencier 4b115d458f optimized a comparison in the tokenizer 2011-10-31 18:03:19 +01:00
Fabien Potencier 88dd4ac579 added notes in the doc about how the defined test and the default filter work 2011-10-30 14:47:32 +01:00
Fabien Potencier c001264a06 merged branch nikic/allowIsDefinedOnMethods (PR #490)
Commits
-------

930330f Allow defined test and default filter on methods

Discussion
----------

Allow defined test and default filter on methods

Patch for #487.

---------------------------------------------------------------------------

by fabpot at 2011/10/30 03:45:49 -0700

Problem is when some of the arguments reference variables that do not exist (`foo.bar(bar.foobar)`). That's why I've added the check on arguments.

---------------------------------------------------------------------------

by nikic at 2011/10/30 03:58:58 -0700

@fabpot I'm not exactly sure what is the expected behavior in that case. When writing `foo.defined(undefined)|default()` I think an exception is the expected behavior (because there is an undefined variable without default, even if it is in the method arguments). With `foo.undefined(undefined)|default()` on the other hand I'm not sure. One could argue that as the method does not exist the arguments never need to be evaluated.

---------------------------------------------------------------------------

by fabpot at 2011/10/30 05:49:46 -0700

The same code is used for the `defined` test: what would be the expected behavior for `foo.defined(underfined) is defined`?
2011-10-30 14:46:53 +01:00
Fabien Potencier d7120d1bf2 merged branch nikic/patch-1 (PR #489)
Commits
-------

7da9f2f Make long var/block tests faster

Discussion
----------

Make long var/block tests faster

When using `*` every single character is a different token, whereas with `x` there is only a single token. I don't think this hurts the actual test, but it improves the test runtime by something like 2/3 seconds on my machine.
2011-10-30 11:43:00 +01:00
nikic 930330fff0 Allow defined test and default filter on methods 2011-10-30 11:19:27 +01:00
nikic 7da9f2f9eb Make long var/block tests faster 2011-10-30 11:03:56 +01:00
Fabien Potencier cf6116c2a8 fixed previous commit 2011-10-29 15:13:27 +02:00
Fabien Potencier b3f472e479 renamed none to null in doc 2011-10-29 14:56:00 +02:00
Fabien Potencier 8d00b42e56 changed the documentation to advertize null as begin the null value and none as an alias 2011-10-29 14:53:37 +02:00
Fabien Potencier dfdd555b9a fixed in operator for empty strings 2011-10-29 14:50:10 +02:00
Fabien Potencier dc15afabb8 merged branch nikic/updateExtensionDocs (PR #488)
Commits
-------

2ebc788 Update extension docs and interface

Discussion
----------

Update extension docs and interface

Followup to #484: Twig isn't using globals for functions anymore.
2011-10-29 14:38:23 +02:00
nikic 2ebc788abc Update extension docs and interface
Twig isn't using globals for functions anymore.
2011-10-29 14:05:14 +02:00
Fabien Potencier 2bd27cf661 fixed typo in doc 2011-10-28 17:23:01 +02:00
Fabien Potencier 1b46f06394 merged branch phmLabs/documentation_return (PR #483)
Commits
-------

389f2c2 Changed mode from 0755 to 0644
c48bd2f Fixed wrong used PHPDoc tags

Discussion
----------

Fixed wrong used PHPDoc tags

@param was used instead of @return

---------------------------------------------------------------------------

by fabpot at 2011/10/25 05:47:59 -0700

Can you revert the mode change (from 0644 to 0755)?
2011-10-27 21:47:32 +02:00
Fabien Potencier b318494cfe added more unit tests for defined and default 2011-10-27 18:35:23 +02:00
Fabien Potencier 29534aada8 fixed the "defined" test and the "default" filter 2011-10-27 18:26:17 +02:00
Fabien Potencier 52a8afd67c added more unit tests (some do not pass... yet) 2011-10-26 22:23:21 +02:00
Fabien Potencier 3201b39f47 added missing supported charset for htmlspecialchars 2011-10-26 11:28:33 +02:00
Fabien Potencier 5e290cbb4d fixed deep nested defined tests 2011-10-26 11:20:38 +02:00
Fabien Potencier 5da378ceaa removed unneeded complexity in GetAttr node 2011-10-26 10:28:26 +02:00
Fabien Potencier 996128dfce added a way to change Twig's options when running integration tests (updated tests accordingly) 2011-10-26 09:29:16 +02:00
Fabien Potencier 13e4b4800e Revert "fixed exception"
This reverts commit df47659e9d.
2011-10-26 08:05:11 +02:00
Fabien Potencier 96e72e408a fixed example in doc (closes #484) 2011-10-25 17:37:58 +02:00
Nils Langner 389f2c2603 Changed mode from 0755 to 0644 2011-10-25 16:49:17 +02:00
Fabien Potencier 22ef32e5eb added some references to the doc 2011-10-25 16:33:42 +02:00
Nils Langner c48bd2f809 Fixed wrong used PHPDoc tags 2011-10-25 14:32:16 +02:00
Fabien Potencier 08f125395c reverted mode change from previous commit 2011-10-25 14:23:37 +02:00
Fabien Potencier 7001217ed3 merged branch phmLabs/Twig_NodeInterface_Bug (PR #482)
Commits
-------

c91357d Moved interfaces

Discussion
----------

Moved interfaces

The Countable and IteratorAggregate interfaces have to be part of the Twig_NodeInterface as the Twig_NodeInterface is used as a typehint and the function tries to iterate over its elements.

E.g:

Twig_NodeTraverser::traverseForVisitor

foreach ($node as $k => $n)
2011-10-25 14:23:22 +02:00
Fabien Potencier fc016bd281 Revert "added a tip for the block tag"
This reverts commit 1a2175fc49.
2011-10-25 14:14:55 +02:00
Nils Langner c91357d0c7 Moved interfaces 2011-10-25 14:13:26 +02:00
Fabien Potencier 1a2175fc49 added a tip for the block tag 2011-10-25 14:11:52 +02:00
Fabien Potencier 5483e995b0 merged branch yegeniy/patch-1 (PR #474)
Commits
-------

cf03a65 add another example add another example to constant.rst

Discussion
----------

add another example

An example for using the `constant` function

---------------------------------------------------------------------------

by yegeniy at 2011/10/19 09:48:37 -0700

Should be ready.

---------------------------------------------------------------------------

by nikic at 2011/10/19 10:58:01 -0700

I think you should just add that as a line to the other example, so you got this in the end:

```rst
``constant``
============

``constant`` returns the constant value for a given string:

.. code-block:: jinja

    {{ some_date|date(constant('DATE_W3C')) }}
    {{ constant('Namespace\\Classname::CONSTANT_NAME') }}
```

---------------------------------------------------------------------------

by fabpot at 2011/10/21 07:24:32 -0700

That's indeed a good addition to the doc. Can you squash your commits in to one before I merge this pull request? Thanks.

---------------------------------------------------------------------------

by yegeniy at 2011/10/22 06:28:58 -0700

Thanks!
2011-10-25 14:01:54 +02:00
Fabien Potencier 25c9df5354 fixed typos 2011-10-25 13:59:24 +02:00
Fabien Potencier 2c7b565132 changed the way extensions are loaded (addFilter/addFunction/addGlobal/addTest/addNodeVisitor/addTokenParser/addExtension can now be called in any order) 2011-10-25 13:58:27 +02:00
Eugene Wolfson cf03a65e8b add another example
add another example to constant.rst
2011-10-22 09:27:23 -04:00
Fabien Potencier d10966132b added Twig_Environment::display() 2011-10-17 13:01:40 +02:00
Fabien Potencier f6961d558d simplified some code 2011-10-17 02:48:36 +02:00
Fabien Potencier a41c6e21d2 added more unit tests 2011-10-17 01:16:34 +02:00
Fabien Potencier e7347160cb added an optimization when the same temporary variable would have been created twice 2011-10-16 22:18:02 +02:00
Fabien Potencier d3178d3406 fixed doc 2011-10-16 11:15:40 +02:00
Fabien Potencier 344043e891 made the escape filter smarter when the encoding is not supported by PHP 2011-10-16 11:12:08 +02:00
Fabien Potencier c015e8184a added a convert_encoding filter 2011-10-16 11:12:06 +02:00
Fabien Potencier 846a2c134d added a Twig_Node_Expression_DefaultFilter to replace the current way of dealing with default filters 2011-10-16 05:46:09 +02:00
Fabien Potencier ac3bb814d5 added public getters on the environment to be able to get various stuff 2011-10-15 10:57:18 +02:00
Fabien Potencier df47659e9d fixed exception 2011-10-15 01:10:30 +02:00