From: Fabien Potencier Date: Mon, 28 May 2012 20:54:16 +0000 (+0200) Subject: merged branch maartendekeizer/master (PR #738) X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=b6e417ecf776566d4164ab4f338b6315fa5bd462;p=konrad%2Ftwig.git merged branch maartendekeizer/master (PR #738) Commits ------- f0a0036 Add abs filter including unit test and documentation Discussion ---------- Add abs filter to Twig With abs it is possible to make negative values positive and leave positive values positive. --------------------------------------------------------------------------- by maartendekeizer at 2012-05-26T19:02:34Z Example when using abs {% if days_left < 0 %} {{ days_left|abs }} days to late! {% else %} {{ days_left }} days left {% endif %} --------------------------------------------------------------------------- by stof at 2012-05-26T19:12:43Z I'm not sure about adding this filter in the core. I think it would be better in the Twig-extensions repo. @fabpot thoughts ? --------------------------------------------------------------------------- by maartendekeizer at 2012-05-26T21:18:47Z @stof abs is a really basic/natural function it belongs to the base mathematic functions. If this was an implementation of for example the ABC-formula or Pythagoras it must be in the extension repo., but abs is more core related I think. --------------------------------------------------------------------------- by fabpot at 2012-05-27T07:11:33Z Can you add some unit tests and squash your commits? Thanks. --------------------------------------------------------------------------- by maartendekeizer at 2012-05-27T14:40:56Z First time squashing commits; learned something new :-). I will add a unit test tomorrow. --------------------------------------------------------------------------- by maartendekeizer at 2012-05-27T17:36:58Z Unit test and documentation added. --------------------------------------------------------------------------- by fabpot at 2012-05-27T18:41:25Z After fixing the markup issue, you will have to squash again ;) --------------------------------------------------------------------------- by maartendekeizer at 2012-05-27T20:44:29Z Done --------------------------------------------------------------------------- by fabpot at 2012-05-28T19:19:55Z Looks like you have not squash your commits. --------------------------------------------------------------------------- by maartendekeizer at 2012-05-28T20:05:34Z @fabot you want one commit for the complete pr? --------------------------------------------------------------------------- by fabpot at 2012-05-28T20:06:53Z For such a PR, yes. --- b6e417ecf776566d4164ab4f338b6315fa5bd462