-
Notifications
You must be signed in to change notification settings - Fork 10
Implement AST changes #16
Conversation
I'm a little concerned someone might accidentally use this with a version of code-gen that has not been updated. We should update code-gen first and have it check explicitly for |
My understanding is that because the versions of these modules are <1, added the fact that a version of jade that uses these features has not been released, we can break compat in whatever way we want. I guess we should |
I agree in principle, but given that this is such a security critical feature I want to be extra careful :) |
This is orthogonal to MixinBlock. See pugjs/pug#2124.
This looks good except for the filtered include. Once that's updated to match our discussion in pugjs/pug-ast-spec#3, please reassign this pull request to me and ping me to have another look. |
@ForbesLindesay, updated. Note that I left some commented-out errors in place, which we can use when pugjs/pug#2155 is implemented. |
the |
@jeromew I believe changing it is planned for the next release: pugjs/pug#2055 |
@@ -270,7 +263,7 @@ Parser.prototype = { | |||
type: 'Code', | |||
val: tok.val, | |||
buffer: tok.buffer, | |||
escape: tok.escape, | |||
mustEscape: tok.mustEscape !== undefined ? tok.mustEscape : tok.escape, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer just tok.mustEscape !== false
here. That fails to safe. Alternatively (perhaps as well) we could add an assert(typeof tok.mustEscape === 'boolean')
check before this. I want to ensure everyone is on a compatible version, and that if they aren't then it's not dangerous, rather than trying to necessarily just work.
This is looking pretty good apart from those few minor points. @jeromew yes, 3.0.0 will deprecate or remove the |
@ForbesLindesay all fixed. |
// If there is a block, just ignore it. | ||
this.block(); | ||
// TODO: make this a warning | ||
// this.error('Raw inclusion cannot contain a block; block ignored', 'RAW_INCLUDE_BLOCK', this.peek()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just make this a hard error? The block has always been ignored in the past so it seems fine to remove it as we release this major version.
You can merge this once RawInclude + Block is a hard error. |
Implement AST changes according to: