Permalink
Switch branches/tags
Commits on Mar 18, 2012
  1. prepared the 1.6.2 release

    committed Mar 18, 2012
Commits on Mar 17, 2012
  1. fixed sandbox mode when used with inheritance (closes #656)

    The checkSecurity() method must be called by each template as we are not
    using inheritance.
    committed Mar 17, 2012
Commits on Mar 15, 2012
  1. fixed the date filter when a DateTime instance is passed with a speci…

    …fic timezone (closes #660)
    committed Mar 15, 2012
  2. 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.
    committed Mar 15, 2012
Commits on Mar 13, 2012
  1. 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.
    committed Mar 13, 2012
Commits on Mar 12, 2012
  1. Added a trim filter

    Closes #634
    stof committed Mar 12, 2012
Commits on Mar 10, 2012
  1. 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.
    committed Mar 10, 2012
  2. 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.
    andrerom committed Mar 10, 2012
Commits on Mar 1, 2012
  1. fixed typo

    committed Mar 1, 2012
Commits on Feb 29, 2012
  1. fixed previous commit

    committed Feb 29, 2012
  2. merged branch robo47/docs-install-via-composer (PR #648)

    Commits
    -------
    
    7153ff6 Installing twig via composer
    
    Discussion
    ----------
    
    Installing twig via composer
    
    Installing twig via composer
    committed Feb 29, 2012
  3. bumped Twig version

    committed Feb 29, 2012
  4. fixed typo in the doc

    committed Feb 29, 2012
  5. fixed typos in the doc

    committed Feb 29, 2012
  6. prepared the 1.6.1 release

    committed Feb 29, 2012
Commits on Feb 28, 2012
  1. fixed Twig C extension

    committed Feb 28, 2012
  2. fixed CS

    committed Feb 28, 2012
  3. added some unit tests

    committed Feb 28, 2012
Commits on Feb 27, 2012
  1. Installing twig via composer

    robo47 committed Feb 27, 2012
Commits on Feb 21, 2012
Commits on Feb 19, 2012
  1. Revert "merged branch m0ppers/master (PR #611)"

    This reverts commit 5f4e6d7, reversing
    changes made to a61d420.
    committed Feb 19, 2012
Commits on Feb 18, 2012
  1. updated CHANGELOG

    committed Feb 18, 2012
  2. 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);
    committed Feb 18, 2012
  3. 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.
    committed Feb 18, 2012
  4. updated CHANGELOG

    committed Feb 18, 2012
  5. 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.
    committed Feb 18, 2012
Commits on Feb 17, 2012
  1. Avoid creating unnecessary Twig_Markup instances, allows testing for …

    …falsiness of empty output
    Seldaek committed Feb 17, 2012
  2. added phpdoc (closes #627)

    committed Feb 17, 2012
Commits on Feb 15, 2012
  1. fixed previous merge

    committed Feb 15, 2012