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

Improve gumbo error messages during tree construction #2863

Merged
merged 1 commit into from
Apr 27, 2023

Conversation

flavorjones
Copy link
Member

@flavorjones flavorjones commented Apr 27, 2023

What problem is this PR intended to solve?

Gumbo tree constructions errors could be improved. In this PR we're adding punctuation, cleaning up whitespace, and naming the input tag.

If the message was:

1:13: ERROR: This tag isn't allowed here Currently open tags: html, body, div, table.

it is now:

1:13: ERROR: Start tag 'svg' isn't allowed here. Currently open tags: html, body, div, table.

Have you included adequate test coverage?

No tests exist for error message contents. This is a potential area we could improve in the future.

Does this change affect the behavior of either the C or the Java implementations?

No behavioral changes other than the contents of the error message.

@flavorjones flavorjones added the topic/gumbo Gumbo HTML5 parser label Apr 27, 2023
Copy link
Contributor

@stevecheckoway stevecheckoway left a comment

Choose a reason for hiding this comment

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

This is obviously an improvement over what we have. LGTM.

gumbo-parser/src/error.c Outdated Show resolved Hide resolved
adding punctuation, cleaning up whitespace, and naming the input tag

If the message was:

> 1:13: ERROR: This tag isn't allowed here  Currently open tags: html, body, div, table.

it is now something like:

> 1:13: ERROR: Start tag 'svg' isn't allowed here. Currently open tags: html, body, div, table.
@flavorjones flavorjones force-pushed the flavorjones-improve-gumbo-error-messages branch from feea968 to 37c29a5 Compare April 27, 2023 17:11
@flavorjones flavorjones merged commit 839aa37 into main Apr 27, 2023
@flavorjones flavorjones deleted the flavorjones-improve-gumbo-error-messages branch April 27, 2023 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/gumbo Gumbo HTML5 parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants