Unable to skip arguments in fragments when using keyword arguments
See original GitHub issueTo Reproduce
Step by step instructions to reproduce the behavior:
Add to a page template:
{% fragment listNumbers(first, second, third=3, fourth=4) %}
<p>{{ first }} {{ second }} {{ third }} {{ fourth }}</p>
{% endfragment %}
{% render listNumbers(1, 2) %}
{# Renders: `<p>1 2 3 4</p> #}
{% render listNumbers(1, third=9) %}
{# Renders: `<p>1 9 4</p> #}
Expected behavior
The rendered code should match the comments. Specifically, in the second example the “second” argument should be null
. That is the behavior with Nunjucks macros.
Describe the bug
The missing second argument is passed an object of the keyword arguments instead:
{ third: 9, __keywords: true }
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Why can't I pass an argument to fragment using navigation ...
I am using SafeArgs and I only get this error when I define a default value for this argument. enter image description here....
Read more >How to skip arguments when using a function - Julia Discourse
For positional arguments only the last parameters can have a default value, so say, you can't skip the second out of three arguments....
Read more >Queries and Mutations - GraphQL
@skip(if: Boolean) Skip this field if the argument is true . Directives can be useful to get out of situations where you otherwise...
Read more >Navigating with SafeArgs - Medium
SafeArgs is a gradle plugin that allows you to enter information into the navigation graph about the arguments that you want to pass....
Read more >Testing tools - Django documentation
Test that a given request is rendered by a given Django template, with a template ... The values from the extra keyword arguments...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the reminder, @myovchev
@abea The fix is merged so this could be closed?