Writing a custom tag that I would like to work with or without args. Works fine with args, but without args blows up with this error:
undefined is not a function
{% script %}{% endscript %} = gives the error
hopefully you will know what the problem is just by looking at this parse code:
parse: (parser, nodes) ->
tok = parser.nextToken()
args = parser.parseSignature(null, true)
parser.advanceAfterBlockEnd(tok.value)
body = parser.parseUntilBlocks("endscript")
parser.advanceAfterBlockEnd()
new nodes.CallExtension(this, "run", args, [body])
It looks to me that the body is null in my run method, which is why the tag breaks, but i wouldnt expect for that to happen. If there is nothing obviously wrong with the code above, ill provide a more through explanation of the error that i am seeing.
here is the full tag source:
https://github.com/mkoryak/nunjucks-script-tag
Writing a custom tag that I would like to work with or without args. Works fine with args, but without args blows up with this error:
undefined is not a function{% script %}{% endscript %} = gives the error
hopefully you will know what the problem is just by looking at this parse code:
It looks to me that the body is null in my run method, which is why the tag breaks, but i wouldnt expect for that to happen. If there is nothing obviously wrong with the code above, ill provide a more through explanation of the error that i am seeing.
here is the full tag source:
https://github.com/mkoryak/nunjucks-script-tag