Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for unconsumed macro arguments
- Loading branch information
Showing
6 changed files
with
94 additions
and
18 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
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,21 @@ | ||
--TEST-- | ||
macro with arbitrary arguments | ||
--TEMPLATE-- | ||
{% from _self import test1, test2 %} | ||
|
||
{% macro test1(var) %} | ||
{{- var }}: {{ varargs|join(", ") }} | ||
{% endmacro %} | ||
|
||
{% macro test2() %} | ||
{{- varargs|join(", ") }} | ||
{% endmacro %} | ||
|
||
{{ test1("foo", "bar", "foobar") }} | ||
{{ test2("foo", "bar", "foobar") }} | ||
--DATA-- | ||
return array(); | ||
--EXPECT-- | ||
foo: bar, foobar | ||
|
||
foo, bar, foobar |
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,8 @@ | ||
--TEST-- | ||
macro with varargs argument | ||
--TEMPLATE-- | ||
{% macro test(varargs) %} | ||
{% endmacro %} | ||
--EXCEPTION-- | ||
Twig_Error_Syntax: The argument "varargs" in macro "test" cannot be defined because the variable "varargs" is reserved for arbitrary arguments in "index.twig" at line 2 | ||
|
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