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

fix: Syntax issue when closing a script on the same line #35

Merged

Conversation

sirgallifrey
Copy link
Contributor

This PR fixes a syntax highlight issue when closing a script tag on the same line.
The issue is caused because of the .*> which matches twice, first were we would expect, after <script> and then again after <script></script> because all ></script is captured by .*
My change seems to fix it without introducing regressions.

Screenshot 2024-02-24 at 11 05 26
Screenshot 2024-02-24 at 11 05 52

Before:
Screenshot 2024-02-24 at 12 13 28
After:
Screenshot 2024-02-24 at 12 12 42

@sirgallifrey
Copy link
Contributor Author

I put some minimal reproductions on the main description, here's my real use case:

Before:
Screenshot 2024-02-24 at 12 29 33
After:
Screenshot 2024-02-24 at 12 29 57

Copy link
Contributor

@alehechka alehechka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me for <script> tags. It looks like <style> tags have the same problem, would you mind adding a similar solution to the style-element pattern?

@sirgallifrey
Copy link
Contributor Author

Sure, not a problem

@joerdav joerdav changed the title Fix Syntax issue when closing a script on the same line fix: Syntax issue when closing a script on the same line Feb 29, 2024
@joerdav joerdav merged commit 36b2da7 into templ-go:main Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants