forked from twigphp/Twig
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ Functions | |
date | ||
dump | ||
include | ||
max | ||
min | ||
parent | ||
random | ||
range | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
``max`` | ||
======= | ||
|
||
.. versionadded:: 1.15 | ||
The ``max`` function was added in Twig 1.15. | ||
|
||
``max`` returns the biggest value of a sequence or a set of values: | ||
|
||
.. code-block:: jinja | ||
{{ max(1, 3, 2) }} | ||
{{ max([1, 3, 2]) }} | ||
# When called with a mapping, max ignores keys and only compares values. | ||
{{ max({2:"two", 1:"one", 3:"three", 5:"five", 4:"for"}) }} {# return "two" #} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
``min`` | ||
======= | ||
|
||
.. versionadded:: 1.15 | ||
The ``min`` function was added in Twig 1.15. | ||
|
||
``min`` returns the lowest value of a sequence or a set of values: | ||
|
||
.. code-block:: jinja | ||
{{ min(1, 3, 2) }} | ||
{{ min([1, 3, 2]) }} | ||
# When called with a mapping, min ignores keys and only compares values. | ||
{{ min({2:"two", 1:"one", 3:"three", 5:"five", 4:"for"}) }} {# return "five" #} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--TEST-- | ||
"max" function | ||
--TEMPLATE-- | ||
{{ max([2, 1, 3, 5, 4]) }} | ||
{{ max(2, 1, 3, 5, 4) }} | ||
{{ max({2:"two", 1:"one", 3:"three", 5:"five", 4:"for"}) }} | ||
--DATA-- | ||
return array() | ||
--EXPECT-- | ||
5 | ||
5 | ||
two |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--TEST-- | ||
"min" function | ||
--TEMPLATE-- | ||
{{ min(2, 1, 3, 5, 4) }} | ||
{{ min([2, 1, 3, 5, 4]) }} | ||
{{ min({2:"two", 1:"one", 3:"three", 5:"five", 4:"for"}) }} | ||
--DATA-- | ||
return array() | ||
--EXPECT-- | ||
1 | ||
1 | ||
five |