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

Don't remove child nodes of figures and images. #321

Merged
merged 1 commit into from Feb 3, 2021
Merged

Conversation

samwilson
Copy link
Member

@samwilson samwilson commented Jan 27, 2021

When processing img elements, this was replacing figure and
figure-inline with an img element. This was discarding any
figcaption or other contents of the node.

It doesn't look like there's any reason to do this replacement,
as we're already modifying the img element to our requirements.

Also switch to ctype_xdigit to check for the thumb URL segments
being valid hex digits, because using is_numeric to do this was
deprecated as of PHP 7.0.

Also check for any contained img elements in figure etc. and break
if none found.

Bug: https://phabricator.wikimedia.org/T272307
Bug: https://phabricator.wikimedia.org/T272180

When processing img elements, this was replacing figure and
figure-inline with an img element. This was discarding any
figcaption or other contents of the node.

It doesn't look like there's any reason to do this replacement,
as we're already modifying the img element to our requirements.

Also switch to ctype_xdigit to check for the thumb URL segments
being valid hex digits, because using is_numeric to do this was
deprecated as of PHP 7.0.

Also check for any contained img elements in figure etc. and break
if none found.

Bug: https://phabricator.wikimedia.org/T272307
Bug: https://phabricator.wikimedia.org/T272180
@samwilson
Copy link
Member Author

Rebased.

Copy link
Member

@MusikAnimal MusikAnimal left a comment

Choose a reason for hiding this comment

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

Works in my testing

@MusikAnimal MusikAnimal merged commit 0f3a241 into main Feb 3, 2021
@MusikAnimal MusikAnimal deleted the img-html branch February 3, 2021 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants