Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: text/template/parse: add CommentNode to the parse tree #34652

Open
a8m opened this issue Oct 2, 2019 · 3 comments
Labels
Projects
Milestone

Comments

@a8m
Copy link
Contributor

@a8m a8m commented Oct 2, 2019

Currently, template comments are ignored in the lexer and do not show in the parse tree.
It makes it difficult to build tools around templates (like code formatter) without re-implementing the parser.

My proposal is to add a CommentNode to the parse tree and skip it in the executer.

@andybons andybons changed the title text/template/parse: add CommentNode to the parse tree proposal: text/template/parse: add CommentNode to the parse tree Oct 2, 2019
@gopherbot gopherbot added this to the Proposal milestone Oct 2, 2019
@gopherbot gopherbot added the Proposal label Oct 2, 2019
@mvdan

This comment has been minimized.

Copy link
Member

@mvdan mvdan commented Oct 4, 2019

I assume this can only be accepted if #25357 is rejected.

@a8m

This comment has been minimized.

Copy link
Contributor Author

@a8m a8m commented Oct 4, 2019

I assume this can only be accepted if #25357 is rejected.

Why? It's a Go2 proposal, and text/template/parse is a public package that's being used outside.

@mvdan

This comment has been minimized.

Copy link
Member

@mvdan mvdan commented Oct 10, 2019

Yes; but if the plan is to eventually hide/remove the template/parse package, considering API changes to it wouldn't make a lot of sense. At the very least, the two proposals are related.

@rsc rsc added this to Incoming in Proposals Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Proposals
Incoming
3 participants
You can’t perform that action at this time.