Operating system
Ubuntu 20
Eleventy
3.0.0
Describe the bug
If you add a shortcode with no parameter to a nunjucks template, it appears that the engine adds an empty string as a parameter. In other words, {% test %}is equivalent to {% test "" %}. This is not the behavior of liquid templates, where -- it appears -- {% test %}is equivalent to {% test undefined %}.
This might be related to #372. Hard to tell, because there's not much info in the issue, but I looked at the commit that resolved it (5cd19f6), and it looks like the engine adds an empty string (cf. line 80+), apparently to resolve a nunjucks bug.
Reproduction steps
- Create a shortcode in an eleventy config file.
- Call that shortcode from a nunjucks template with no parameter.
console.log the typeof the parameter.
Expected behavior
In javascript, calling a function with no parameter passes undefined. So I think liquid's behavior is correct, and nunjucks' is not. However, maybe the nunjucks bug #372 prevents consistent behavior.
Demo
https://github.com/btrem/11ty_3788
Operating system
Ubuntu 20
Eleventy
3.0.0
Describe the bug
If you add a shortcode with no parameter to a nunjucks template, it appears that the engine adds an empty string as a parameter. In other words,
{% test %}is equivalent to{% test "" %}. This is not the behavior of liquid templates, where -- it appears --{% test %}is equivalent to{% test undefined %}.This might be related to #372. Hard to tell, because there's not much info in the issue, but I looked at the commit that resolved it (5cd19f6), and it looks like the engine adds an empty string (cf. line 80+), apparently to resolve a nunjucks bug.
Reproduction steps
console.logthetypeofthe parameter.Expected behavior
In javascript, calling a function with no parameter passes undefined. So I think liquid's behavior is correct, and nunjucks' is not. However, maybe the nunjucks bug #372 prevents consistent behavior.
Demo
https://github.com/btrem/11ty_3788