Skip to content

fix: html5ever may hide actual errors#704

Merged
Martin1887 merged 6 commits intomasterfrom
fix-702
Jan 22, 2024
Merged

fix: html5ever may hide actual errors#704
Martin1887 merged 6 commits intomasterfrom
fix-702

Conversation

@Martin1887
Copy link
Collaborator

Fixes: #702.

html5ever could be removed if this change is approved (pending commit in this pull request).

Please, @ollpu, @raphlinus, review this pull request. This change makes more difficult creating tests but the avoiding of false negatives may pay off.

Copy link
Collaborator

@ollpu ollpu left a comment

Choose a reason for hiding this comment

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

The standardization logic implemented here seems to be a good balance. It took me a while to understand the intent of the >\n< -> >< replacement (newlines can be added between tags to aid legibility, but spaces around inline tags are not interchangeable with newlines), so maybe that could be clarified somewhere.

Couple comments about the replacements that eat (potentially meaningful) whitespace.

tests/lib.rs Outdated
.replace("<br/>", "<br />")
.replace("<hr>", "<hr />")
.replace("<hr/>", "<hr />")
.replace('\t', "")
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems to only affect regression_test_83 where there is

| foo | bar  |
→|-----|------|
| baz | alef |

expected to render as

<p>| foo | bar  |
→|-----|------|
| baz | alef |</p>

But isn't that incorrect? The leading whitespace should be trimmed in the output.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Uhm, it seems so, I have to check it. Thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the test was incorrect, now should be right.

@raphlinus
Copy link
Collaborator

Yes, this seems like it admits more precise tests. I didn't go through all the changes in detail, so am glad that @ollpu seems to have gone through it in more detail. I'd be quite happy for them to give a final approval if they're willing to spend the time.

@Martin1887
Copy link
Collaborator Author

Finally!

@Martin1887 Martin1887 merged commit 11f8c4a into master Jan 22, 2024
@Martin1887 Martin1887 deleted the fix-702 branch January 22, 2024 18:55
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.

Parsing to normalize HTML in spec tests not always appropriate

3 participants