Permalink
Switch branches/tags
Commits on Sep 28, 2012
  1. prepared the 1.10.0 release

    fabpot committed Sep 28, 2012
Commits on Sep 26, 2012
  1. merged branch hason/php52 (PR #849)

    fabpot committed Sep 26, 2012
    Commits
    -------
    
    adb5d4f Fixed PHP 5.2 incompatibilty
    
    Discussion
    ----------
    
    Fixed PHP 5.2 incompatibilty
  2. Fixed PHP 5.2 incompatibilty

    hason committed Sep 26, 2012
Commits on Sep 18, 2012
  1. updated CHANGELOG

    fabpot committed Sep 18, 2012
  2. tweaked docs

    fabpot committed Sep 18, 2012
  3. merged branch drak/reusable_fixtures (PR #805)

    fabpot committed Sep 18, 2012
    Commits
    -------
    
    36372c6 Made node tests reusable
    
    Discussion
    ----------
    
    Reusable tests and fixtures
    
    This PR makes Twig integration testing reusable for 3rd party extensions.
    
    I have implemented resuable functional tests.
    
    The [test runner](https://github.com/zikula/core/blob/master/src/Zikula/Bundle/CoreBundle/Tests/Twig/IntegrationTest.php) and the [fixtures](https://github.com/zikula/core/tree/master/src/Zikula/Bundle/CoreBundle/Tests/Twig/Fixtures) are the only part that an extension needs to implement itself.
    
    I've included documentation in the PR.
    
    ---------------------------------------------------------------------------
    
    by jusuff at 2012-08-11T20:41:55Z
    
    This PR would make things little easier. Right now tests are organized in confusing way and are hard to implement for Twig extensions
    
    ---------------------------------------------------------------------------
    
    by drak at 2012-08-14T09:09:45Z
    
    @fabpot - This is ready for merging now. When it's merged I'll update the documentation as this PR significantly eases our ability to test extensions.
    
    ---------------------------------------------------------------------------
    
    by fabpot at 2012-09-16T14:28:16Z
    
    @drak Do you plan to update this PR with the code you have in Zikula?
    
    ---------------------------------------------------------------------------
    
    by drak at 2012-09-16T14:37:30Z
    
    @fabpot - Yes, I just need a couple of days (or less).
    
    ---------------------------------------------------------------------------
    
    by drak at 2012-09-17T12:00:34Z
    
    @fabpot - I have ported over the code.
    
    ---------------------------------------------------------------------------
    
    by drak at 2012-09-18T08:23:18Z
    
    @fabpot - I updated Zikula to us this particular branch so there is a practical test. I've updated the links in the top description part of this PR with the relevant links. The PR also refactors Twig's core tests to use the re-usable test base classes.
    
    ---------------------------------------------------------------------------
    
    by fabpot at 2012-09-18T09:01:10Z
    
    @drak Can you squash your commits before I merge? Thanks.
    
    ---------------------------------------------------------------------------
    
    by drak at 2012-09-18T09:14:08Z
    
    @fabpot - I've squashed them now. Thanks!
  4. Made node tests reusable

    Drak committed Sep 17, 2012
  5. merged branch hason/loader (PR #838)

    fabpot committed Sep 18, 2012
    Commits
    -------
    
    c503287 Fixed typo in Filesystem loader
    
    Discussion
    ----------
    
    Fixed typo in Filesystem loader
Commits on Sep 17, 2012
  1. Fixed typo in Filesystem loader

    hason committed Sep 17, 2012
Commits on Sep 16, 2012
  1. merged branch fabpot/named-paths (PR #772)

    fabpot committed Sep 16, 2012
    Commits
    -------
    
    7e5acd1 fixed some possible warnings
    f0d0d6d fixed typo
    b7076fe added Twig_Loader_Filesystem::getNamespaces()
    8f7ccd1 moved an exception
    9426072 tweaked documentation
    b9afa84 renamed the default filesystem namespace to __main__
    c34541d changed notation of namespaced templates to @namespace/template_path
    0eb4d01 added namespaced templates support in Twig_Loader_Filesystem
    c24ea1b added Twig_Loader_Filesystem::prependPath()
    
    Discussion
    ----------
    
    added namespaced templates support in Twig_Loader_Filesystem
    
    Everything is explained in the updated documentation.
    
    Basically, it gives more flexibility when it comes to manage many templates that are not necessarily related (think frontent vs backend for instance, or templates from different Symfony bundles, ...). It is useful if, for each namespace, you need to look for templates in different directories. This implementation would probably be enough to replace the current Symfony bundle template paths, with more flexibility and less restrictions.
    
    Feedback is more than welcome. One thing I'm not sure about is the `#` separator between the namespace and the template path. Is it the best choice? We need a character that is not used in filesystem paths, so good candidates are: `@`, `!`, `%`, `$`, `*`, `;`, `?`.
    
    Some immediate benefits: give the same template flexibility that we have in Symfony to other frameworks using Twig like Silex. Another benefit would be the ability to share template between Symfony and other frameworks like Twig (more on a proof of concept later).
    
    ---------------------------------------------------------------------------
    
    by alessandro1997 at 2012-07-14T16:25:42Z
    
    This is very nice, and I think # is a great choice for the separator character. We could also use @.
    
    ---------------------------------------------------------------------------
    
    by jjbohn at 2012-07-14T16:25:59Z
    
    👍 for #
    
    ---------------------------------------------------------------------------
    
    by Symfomany at 2012-07-14T16:27:45Z
    
    Pipe character isn't candidate?
    
    ---------------------------------------------------------------------------
    
    by inspiran at 2012-07-14T16:32:52Z
    
    I remember from the wetter.com talk at sf live that they actually implemented a similar functionality: allow twig templates to be defined different from the default path.   So they had something like:
    
    {% extends "cms://Home/weather/..."  ... %}
    If we could make the "cms" part a configurable setting then one could use it to point to a custom folder or even to a content provider (symfony cmf?)
    
    Maybe that would be another approach?
    
    ---------------------------------------------------------------------------
    
    by fabpot at 2012-07-14T16:33:21Z
    
    The other syntax possibility is something more like we have in Symfony: `@namespace/template_path`.
    
    ---------------------------------------------------------------------------
    
    by fabpot at 2012-07-14T16:34:37Z
    
    @inspiran: that's another possibility: use the PHP stream notation.
    
    ---------------------------------------------------------------------------
    
    by mvrhov at 2012-07-14T16:36:18Z
    
    I'd also prefer uri/php streams syntax...
    
    ---------------------------------------------------------------------------
    
    by Tobion at 2012-07-14T16:41:16Z
    
    On Windows I can create a file with `#` in it. How does it distinguish that? I don't think we will find a single seperation character that works on all file systems, do we? And `@` (e.g. namespace@file) would be semantically strange (unless you read it from right-to-left).
    So I'd also prefer uri/php stream syntax.
    
    ---------------------------------------------------------------------------
    
    by Symfomany at 2012-07-14T16:43:17Z
    
    @fabpot  Pointer Syntax? or greater than character?
    
    ---------------------------------------------------------------------------
    
    by markstory at 2012-07-14T16:43:48Z
    
    I'm in favour of the `foo://` style syntax.  It is similar to other parts of PHP, and avoids overlap with filesystem characters, and doesn't introduce new unique syntax.
    
    ---------------------------------------------------------------------------
    
    by stof at 2012-07-14T16:44:25Z
    
    @fabpot ``@namespace/template_path`` would make it confusing in Symfony. Because locating a resource with the kernel would use ``@AcmeDemoBundle/Resources/views/layout.html.twig`` whereas Twig would find the same file as ```@AcmeDemoBundle/layout.html.twig``.
    
    And none of ``#``, ``@``, ``!``, ``%``, ``$`` or ``;`` is forbidden in filenames on Windows.
    
    So I think the URI/stream notation is fine
    
    ---------------------------------------------------------------------------
    
    by maryo at 2012-07-14T16:46:44Z
    
    On Windows @!%$; are valid. Invalid characters are \/:*?"<>|
    
    ---------------------------------------------------------------------------
    
    by maryo at 2012-07-14T16:47:55Z
    
    Is > allowed on Linux?
    
    ---------------------------------------------------------------------------
    
    by jschreuder at 2012-07-14T16:49:17Z
    
    Some thoughts from a non-Symfony user:
    
    * Not sure about the `#`, on the one hand it is used as the comment character on the other hand I'm also familiar with it as a membership operator (which supports its usage)
    * The streams/PHP syntax: I don't really like this, the syntax signifies some type of protocol to be used. Even stretched to the limits of its definition you wouldn't be able to define different namespaces as different protocols (same protocol, different location).
    * `@namespace/file/path` - kind of like this one, the `@` signifies that it is followed by a special symbol (being the namespace name) and other than that a normal path.
    * Another option we've used in Fuel is the double colon `::` as in `namespace::file/path` (like the `#` it signifies membership, but doesn't have another significance in Twig)
    
    ---------------------------------------------------------------------------
    
    by gunnarlium at 2012-07-14T17:10:15Z
    
    Does it matter what symbols are valid in filenames? Won't the separator just be used for exploding the string into namespace and path, and thus never be used to directly access a file?
    
    ---------------------------------------------------------------------------
    
    by alessandro1997 at 2012-07-14T17:15:27Z
    
    As @gunnarlium said, what's the problem with filenames?
    
    ```php
    $path = 'namespace#new#page.html';
    $parts = explode('#', $path, 2);
    list($namespace, $filename) = $parts;
    
    // "namespace and "new#page.html"
    var_dump($namespace, $filename);
    ```
    
    ---------------------------------------------------------------------------
    
    by stof at 2012-07-14T17:16:19Z
    
    @gunnarlium the issue is that if you use this symbols in the filename of your template without namespace, Twig will consider it as a namespaced template for another file name
    
    ---------------------------------------------------------------------------
    
    by stof at 2012-07-14T17:16:45Z
    
    @alessandro1997 the issue is that namespaces are optional
    
    ---------------------------------------------------------------------------
    
    by alessandro1997 at 2012-07-14T17:17:07Z
    
    @stof Oh, right. I didn't get that :-)
    
    ---------------------------------------------------------------------------
    
    by gunnarlium at 2012-07-14T17:20:32Z
    
    @stof Ok, I see. So what we want is a symbol which is not allowed as a filename? Or (suboptimally) just add a requirement that template filenames can't contain certain reserved symbols?
    
    ---------------------------------------------------------------------------
    
    by fabpot at 2012-07-14T17:23:37Z
    
    But then, who is using `#` in a filename?
    
    Anyway, I'm going to implement a version based on PHP streams to stick to the PHP way. Using a PHP stream might also allow us to get rid of the array loader.
    
    ---------------------------------------------------------------------------
    
    by alessandro1997 at 2012-07-14T17:24:01Z
    
    @gunnarlium But how would we check if the user is using reserved symbols in template names? Twig isn't aware of the available templates' names until the user requests them. And when he/she does it's too late because Twig doesn't know if the separator is used as namespace or if it's part of the filename.
    
    ---------------------------------------------------------------------------
    
    by stof at 2012-07-14T17:33:38Z
    
    @fabpot even if no sane guy would probably use ``#`` in a filename, it would mean that Twig assumes that all its userbase is sane :)
    
    ---------------------------------------------------------------------------
    
    by lolautruche at 2012-07-14T18:51:53Z
    
    -1 for #
    +1 for php stream, though I agree with @jschreuder's arguments against it
    +2 for @ syntax like in Symfony. I find it more consistent.
    
    ---------------------------------------------------------------------------
    
    by fabpot at 2012-07-14T19:50:31Z
    
    One problem with PHP streams is that it makes using template names quite ugly and verbose:
    
        {% include 'twig://namespace/index.html' %}
    
    And for non-namespaced templates:
    
        {% include 'twig:///index.html' %}
    
    for which we can provide a shortcut:
    
        {% include 'index.html' %}
    
    ---------------------------------------------------------------------------
    
    by fabpot at 2012-07-14T19:54:35Z
    
    If we are using `@` like in Symfony, it will be:
    
        {% include '@namespace/index.html' %}
    
    And for non-namespaced templates:
    
        {% include 'index.html' %}
    
    And for Symfony users, the notation would be the same as for resources. If we register each bundle path as a namespace, the path would even be exactly the same:
    
        {% include '@AcmeDemoBundle/Resources/views/layout.html.twig' %}
    
    EDIT: that's not so simple because of the templates stored under `app/`.
    
    ---------------------------------------------------------------------------
    
    by mahono at 2012-07-14T19:56:54Z
    
    might not be the best idea, but what about using Backslash as namespace char?
    
    ---------------------------------------------------------------------------
    
    by fabpot at 2012-07-14T19:57:50Z
    
    @mahono: I have not dared to propose this alternative ;)
    
    ---------------------------------------------------------------------------
    
    by fabpot at 2012-07-14T20:06:17Z
    
    I've just made an additional commit that implements the `@namespace/template_path` notation.
    
    ---------------------------------------------------------------------------
    
    by Baachi at 2012-07-14T20:32:41Z
    
    The `@` syntax is the most consistent solution.
    But the integration in symfony2 is really hard and a BC break.
    
    The stream syntax is not a good solution.
    `twig` might already be already registered as a stream.
    
    I would suggest the `::` syntax.
  2. fixed some possible warnings

    fabpot committed Sep 16, 2012
  3. fixed typo

    fabpot committed Sep 16, 2012
  4. merged branch loalf/patch-1 (PR #835)

    fabpot committed Sep 16, 2012
    Commits
    -------
    
    5c805a1 Update doc/intro.rst
    
    Discussion
    ----------
    
    Update doc/intro.rst
    
    How to load Twig using Composer
  5. Update doc/intro.rst

    humandb committed Sep 16, 2012
    How to load Twig using Composer
Commits on Sep 13, 2012
Commits on Sep 12, 2012
Commits on Sep 7, 2012
Commits on Aug 31, 2012
Commits on Aug 30, 2012
  1. merged branch franmomu/patch-1 (PR #821)

    fabpot committed Aug 30, 2012
    Commits
    -------
    
    93b41c3 [Test] Fix double semicolon
    
    Discussion
    ----------
    
    [Test] Fix double semicolon
  2. [Test] Fix double semicolon

    franmomu committed Aug 30, 2012
Commits on Aug 29, 2012
  1. merged branch tkoomzaaskz/master (PR #819)

    fabpot committed Aug 29, 2012
    Commits
    -------
    
    682b0aa improved twig docs: twig for templates designers, NetBeans PHP IDE supports twig natively from 7.2
    
    Discussion
    ----------
    
    twig for template designers: NetBeans 7.2 supports twig natively
    
    from NetBeans 7.2 twig support is native and does not have to be installed manually.
    
    http://plugins.netbeans.org/plugin/40565/php-symfony2-framework
    quote:
    Yes; this extension will be part of NetBeans 7.2, more information here [1].
    Tomas
    [1] http://blogs.oracle.com/netbeansphp/entry/initial_support_for_symfony2
    
    https://blogs.oracle.com/netbeansphp/entry/initial_support_for_symfony2
    
    I checked it myself - installed NB7.2 and it wonderfully highlights twig.
Commits on Aug 28, 2012
  1. improved twig docs: twig for templates designers, NetBeans PHP IDE su…

    ducin committed Aug 28, 2012
    …pports twig natively from 7.2
  2. made a better test

    fabpot committed Aug 28, 2012
  3. fixed an error when a token parser pass a closure as a test to the su…

    fabpot committed Aug 28, 2012
    …bparse() method (closes #818)
Commits on Aug 25, 2012
  1. bumped version to 1.9.3-DEV

    fabpot committed Aug 25, 2012
  2. prepared the 1.9.2 release

    fabpot committed Aug 25, 2012
Commits on Aug 24, 2012
  1. updated CHANGELOG

    fabpot committed Aug 24, 2012
  2. fixed CS

    fabpot committed Aug 24, 2012
  3. merged branch Banane9/patch-1 (PR #817)

    fabpot committed Aug 24, 2012
    Commits
    -------
    
    ca3b156 Added Highlighter for Notepad++ to the list
    
    Discussion
    ----------
    
    Added Highlighter for Notepad++ to the list
    
    Ok I edited it :)
  4. updated CHANGELOG

    fabpot committed Aug 24, 2012
Commits on Aug 23, 2012
  1. merged branch arnaud-lb/792 (PR #814)

    fabpot committed Aug 23, 2012
    Commits
    -------
    
    8fa97bb php5.2 fix
    d6fc86a [Tests] Test accessing a public property when \ArrayAccess is implemented
    6704227 [ext] made ext consistent with 8ec73cf
    228d2b0 [ext] use only read_property handler
    
    Discussion
    ----------
    
    Alternative fix for 792
    
    This fixes #792 as described in https://github.com/fabpot/Twig/issues/792#issuecomment-7482480
    
    - 228d2b0 removes the *object-to-array convertion* trick, since the bug comes from there, and it doesn't appear to be needed
    - 6704227 is the equivalent of aa6b835 + 8ec73cf (this were not needed before because the bug was hidden by the object to array trick: numeric strings and integers are treated equally in arrays keys)
    
    ---------------------------------------------------------------------------
    
    by stof at 2012-08-23T10:19:17Z
    
    @arnaud-lb you need to fix the PHP 5.2 support
  2. merged branch arnaud-lb/fix-zts-5.2 (PR #815)

    fabpot committed Aug 23, 2012
    Commits
    -------
    
    46ce339 [ext] fixed php 5.2 ZTS builds
    
    Discussion
    ----------
    
    [ext] Fixed php 5.2 ZTS builds
    
    In 5.2 zend_hash_apply_with_arguments() and its callback argument do not have a TSRMLS.