-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #1659 Added support for unconsumed macro arguments (hason)
This PR was merged into the 1.x branch. Discussion ---------- Added support for unconsumed macro arguments Fixes #1159 and supplements #1699 Commits ------- 7f00cb9 Added support for unconsumed macro arguments
- Loading branch information
Showing
6 changed files
with
93 additions
and
17 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