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

Refs #30399 -- Made assertHTMLEqual normalize character and entity references. #11343

Merged
merged 1 commit into from May 9, 2019
Merged

Refs #30399 -- Made assertHTMLEqual normalize character and entity references. #11343

merged 1 commit into from May 9, 2019

Conversation

jdufresne
Copy link
Member

No description provided.

@claudep
Copy link
Member

claudep commented May 8, 2019

Thanks, by the way, did you explore the reason we have convert_charrefs=False in the parser? I found this commit, cfff2af#diff-89d6614a06443d1da77f7fed3de3200cL135 but that doesn't explain much. If tests pass with convert_charrefs=True, we would avoid having to code those conversions.

@jdufresne jdufresne changed the title Refs #30399 -- Made assertHTMLEqual normalize numeric character references to base 10. Refs #30399 -- Made assertHTMLEqual normalize character and entity references. May 9, 2019
@jdufresne
Copy link
Member Author

Good suggestion. I like it. I've done this in the latest revision.

The WHITESPACE regex changed to account for the following test:

self.assertHTMLNotEqual('<p>foo bar</p>', '<p>foo &nbsp;bar</p>')

Now that &nbsp; is converted to the non-breaking space code point (U+00A0), it should not be truncated with the space that appears immediately before it.

Copy link
Member

@ngnpope ngnpope left a comment

Choose a reason for hiding this comment

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

Just a couple more things. Looks good.

tests/test_utils/tests.py Outdated Show resolved Hide resolved
tests/test_utils/tests.py Outdated Show resolved Hide resolved
Copy link
Member

@claudep claudep left a comment

Choose a reason for hiding this comment

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

Many thanks for exploring this track!

@jdufresne
Copy link
Member Author

Thanks for the reviews. I've made your suggestions @pope1ni.

Copy link
Member

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

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

Super. Thanks @jdufresne, and @claudep & @pope1ni!

(Grumble, grumble… Windows build… grumble MariaDB… grumble, grumble, grumble… 🙂)

@carltongibson carltongibson merged commit 48235ba into django:master May 9, 2019
@jdufresne jdufresne deleted the assert-html-normalize-charrefs branch May 9, 2019 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants