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

[Java] Java version emits close tag for self-closing tags #361

Closed
kojiishi opened this issue Nov 11, 2023 · 0 comments · Fixed by #362
Closed

[Java] Java version emits close tag for self-closing tags #361

kojiishi opened this issue Nov 11, 2023 · 0 comments · Fixed by #362
Assignees

Comments

@kojiishi
Copy link
Collaborator

Input: <img>abcdef
Expected: <img>abcdef
Actual: <img></img>abcdef

Unlike Python HTMLParser, Java version uses Jsoup.parseBodyFragment, which supports HTML parsing algorithm, so we don't have to worry about issues like #355.

But the serialization code should be aware of self-closing tags.

@kojiishi kojiishi self-assigned this Nov 11, 2023
kojiishi added a commit to kojiishi/budoux that referenced this issue Nov 11, 2023
This patch changes Java `HTMLProcessor` not to emit close tags if the tag is self-closing.

Also adds tests for:
* Unpaired close tags.
* Self-closing tags don't affect skip nodes (e.g., `<nobr>`.)
These test cases are from google#355.

Fixes google#361.
@kojiishi kojiishi changed the title Java version emits close tag for self-closing tags [java] Java version emits close tag for self-closing tags Nov 11, 2023
@kojiishi kojiishi changed the title [java] Java version emits close tag for self-closing tags [Java] Java version emits close tag for self-closing tags Nov 12, 2023
kojiishi added a commit that referenced this issue Nov 13, 2023
* Java: Stop emitting close tags if self-closing

This patch changes Java `HTMLProcessor` not to emit close tags if the tag is self-closing.

Also adds tests for:
* Unpaired close tags.
* Self-closing tags don't affect skip nodes (e.g., `<nobr>`.)
These test cases are from #355.

Fixes #361.
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 a pull request may close this issue.

1 participant