You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get the following error when my template contains the string #} as a comment:
Error: unexpected end of comment
at Object._prettifyError (/home/mat/node_modules/nunjucks/src/lib.js:36:11)
at Template.render (/home/mat/node_modules/nunjucks/src/environment.js:538:21)
at /home/mat/node_modules/nunjucks/src/environment.js:366:27
at createTemplate (/home/mat/node_modules/nunjucks/src/environment.js:315:9)
at handle (/home/mat/node_modules/nunjucks/src/environment.js:327:11)
at /home/mat/node_modules/nunjucks/src/environment.js:339:9
at next (/home/mat/node_modules/nunjucks/src/lib.js:328:7)
at Object.asyncIter (/home/mat/node_modules/nunjucks/src/lib.js:334:3)
at Environment.getTemplate (/home/mat/node_modules/nunjucks/src/environment.js:321:9)
at Environment.render (/home/mat/node_modules/nunjucks/src/environment.js:360:10)
Minimal template that causes the issue:
#}
This is an issue because that pattern can easily be introduced when commenting blocks in the template. I encountered it when templating Terraform code, at some point my IDE commented the code in this way:
#block = {
# test = "value"
#}
This kind of comment pattern can easily sneak-in when editing code.
I'd expect nunjucks to skip the #} token if it misses the opening one, for ease of use and to avoid being surprised: I don't expect a user of the lib to understand that this is interpreted as a end-of-comment token, especially since this tends to follow harmless comment lines.
Thanks for the hard work, available for discussion of course 🙂
The text was updated successfully, but these errors were encountered:
Hi,
I get the following error when my template contains the string
#}
as a comment:Minimal template that causes the issue:
This is an issue because that pattern can easily be introduced when commenting blocks in the template. I encountered it when templating Terraform code, at some point my IDE commented the code in this way:
This kind of comment pattern can easily sneak-in when editing code.
I'd expect nunjucks to skip the
#}
token if it misses the opening one, for ease of use and to avoid being surprised: I don't expect a user of the lib to understand that this is interpreted as a end-of-comment token, especially since this tends to follow harmless comment lines.Thanks for the hard work, available for discussion of course 🙂
The text was updated successfully, but these errors were encountered: