-
-
Notifications
You must be signed in to change notification settings - Fork 298
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
feat: support go expressions in script elements #1065
base: main
Are you sure you want to change the base?
Conversation
Needs an update to the documentation. |
} | ||
} else { | ||
// <script></script> | ||
if err = g.writeElementScript(indentLevel, n.Attributes); err != nil { |
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.
This was confusing at first, but I understand now. This handles script components.
|
||
type scriptElementParser struct{} | ||
|
||
func (p scriptElementParser) Parse(pi *parse.Input) (n Node, ok bool, err error) { |
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.
Could be a parseFunc.
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.
IIRC, function vars cause an allocation on init, hence a minor preference for not having them.
d87fc9b
to
a06e960
Compare
I think this is ready for review now. I ran the fuzz tests for a few hours, getting through about 73M tests without issue. |
Support the use of Go variables within
<script>
elements.Result is: