Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Aug 8, 2011
  1. Fabien Potencier
Commits on Aug 7, 2011
  1. Fabien Potencier

    moved some logic to the constructor (that's allows visitors to have t…

    fabpot authored
    …he real node that will be compiled)
  2. Fabien Potencier
  3. Fabien Potencier
  4. Fabien Potencier

    changed name regex to allow more characters (the same as PHP - works …

    fabpot authored
    …for blocks, tags, functions, filters, and macros - closes #376)
  5. Fabien Potencier

    merged branch nikic/doNotUseNameNodeForFuncNames (PR #410)

    fabpot authored
    Commits
    -------
    
    da4d964 Do not use Node_Expression_Name for function names, just use strings for those
    
    Discussion
    ----------
    
    Do not use Node_Expression_Name for function names
    
    This patch remove the use of Node_Expression_Name for function names and instead uses normal strings for those. This is mainly to prevent problems with static analysis (e.g. using a loop() function would have triggered with_loop), but it also slightly reduces complexity.
Commits on Aug 6, 2011
  1. Nikita Popov
  2. Fabien Potencier

    removed obsolete code

    fabpot authored
  3. Fabien Potencier

    refactored code

    fabpot authored
  4. Fabien Potencier
  5. Fabien Potencier

    removed the possibility to use the extends tag from a block (as it is…

    fabpot authored
    … semantically incorrect and it probably does not work as you expect it to in this case)
  6. Fabien Potencier
  7. Fabien Potencier
  8. Fabien Potencier
  9. Fabien Potencier

    merged branch kotas/master (PR #362)

    fabpot authored
    Commits
    -------
    
    f5b9df9 added `if` modifier support to for loop like {% for k in v if k is odd %}
    
    Discussion
    ----------
    
    [1.2] added `if` modifier support to for loop
    
    Hi.
    
    I'm one of Twig users who love it so much. :)
    
    I've made a patch for adding `if` modifier support to `for` loop in Twig.
    
    Example:
    <pre>
    {% for n in range(0, 5) if n is odd %}
      {{ n }}
    {% endfor %}
    </pre>
    
    Output:
    <pre>
    1
    3
    5
    </pre>
    
    This idea comes from Python's list comprehensions. (like `[n for n in range(0,6) if n % 2 == 1]`)
    
    Here is another example.
    
    Before:
    <pre>
    {% set no_items = true %}
    {% for item in items %}
      {% if item.available %}
        {% set no_items = false %}
        {{ item.name }}
      {% endif %}
    {% endfor %}
    {% if no_items %}
      No items available.
    {% endif %}
    </pre>
    
    After:
    <pre>
    {% for item in items if item.available %}
      {{ item.name }}
    {% else %}
      No items available.
    {% endfor %}
    </pre>
    
    I hope you like it. But If not, just ignore this request. :)
    
    Thanks.
    
    ---------------------------------------------------------------------------
    
    by fabpot at 2011/06/24 01:33:33 -0700
    
    I like it! I will schedule it for inclusion in Twig 1.2. Thanks.
    
    ---------------------------------------------------------------------------
    
    by hhamon at 2011/06/26 16:43:26 -0700
    
    +1
    
    ---------------------------------------------------------------------------
    
    by nikic at 2011/06/27 00:42:14 -0700
    
    I think the idea per se is interesting. But I just checked all Twig templates in my whole codebase and couldn't find any use for it. What was your practical use for this feature @kotas?
    
    ---------------------------------------------------------------------------
    
    by kotas at 2011/06/27 01:52:48 -0700
    
    @nikic My practical use is shown as the second example in the body of this pull request.
    
    Sometimes you need to "filter" an array by seeing its element's property like "item.available" or by some condition like "item.price >= 500".
    
    To do this, in the current version of Twig, you have to write "for" and "if" as nested scopes. And if you want to write {% else %} of the "for" loop, you have to make a temporary variable to see if all elements are skipped.
    
    I think this feature is not essential, but makes templates clean.
    
    ---------------------------------------------------------------------------
    
    by nikic at 2011/06/27 06:23:24 -0700
    
    The thing about `else` seems plausible. +1
    
    ---------------------------------------------------------------------------
    
    by chucktrukk at 2011/08/02 17:39:16 -0700
    
    Also +1. that makes some very clean template code.
  10. Fabien Potencier
Commits on Aug 4, 2011
  1. Fabien Potencier

    merged branch igorw/recipes-highlight (PR #405)

    fabpot authored
    Commits
    -------
    
    0580f19 fix highlighting of snippet in recipes doc
    
    Discussion
    ----------
    
    fix highlighting of snippet in recipes doc
Commits on Jul 31, 2011
  1. Igor
Commits on Jul 30, 2011
  1. Fabien Potencier

    bumped version to 1.2.0-DEV

    fabpot authored
  2. Fabien Potencier

    prepared 1.1.2 released

    fabpot authored
Commits on Jul 28, 2011
  1. Fabien Potencier
  2. Fabien Potencier

    fixed Parser bug

    fabpot authored
Commits on Jul 27, 2011
  1. Fabien Potencier
  2. Fabien Potencier

    merged branch JEDIBC/master (PR #401)

    fabpot authored
    Commits
    -------
    
    755ea99 Correction of a BC break with json_encode and PHP 5.2.x
    
    Discussion
    ----------
    
    BC break with json_encode and php 5.2.x
    
    Hi,
    
    json_encode on php 5.2.x doesn't take the $options parameter wich result in a warning and the function return nothing.
    
    Cheers.
  3. Bruno CHALOPIN
  4. Fabien Potencier
  5. Fabien Potencier
  6. Fabien Potencier

    fixed CS on template output

    fabpot authored
  7. Fabien Potencier

    updated CHANGELOG

    fabpot authored
  8. Fabien Potencier

    fixed previous merge

    fabpot authored
  9. Fabien Potencier

    merged branch hason/optimizer (PR #399)

    fabpot authored
    Commits
    -------
    
    3c5c512 fixed optimization for rendering blocks with variable name
    
    Discussion
    ----------
    
    Fixed bug in optimization
  10. Martin Hasoň
Commits on Jul 26, 2011
  1. Fabien Potencier

    updated CHANGELOG

    fabpot authored
  2. Fabien Potencier
  3. Fabien Potencier

    merged branch netzhuffle/master (PR #396)

    fabpot authored
    Commits
    -------
    
    7b154d6 Switched a tab to four spaces
    29d3cb2 Added testcase for #395
    4fc7a8d Merge remote-tracking branch 'upstream/master'
    c890cf2 Fixed existing tests
    9822ac4 Changed Module.php to pass existing tests
    fab8c72 fixed issue #395
    
    Discussion
    ----------
    
    Fix for issue #395
    
    Fix for #395
    I hope you can use it.
    
    ---------------------------------------------------------------------------
    
    by fabpot at 2011/07/25 00:07:50 -0700
    
    Can you add some unit tests?
    
    ---------------------------------------------------------------------------
    
    by netzhuffle at 2011/07/25 13:57:55 -0700
    
    Here you are.
Something went wrong with that request. Please try again.