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 ignore images #3

Merged
merged 1 commit into from
Sep 16, 2021
Merged

Don't ignore images #3

merged 1 commit into from
Sep 16, 2021

Conversation

afzalIbnSH
Copy link

@afzalIbnSH afzalIbnSH commented Sep 16, 2021

Image in beginning of reply is incorrectly ignored. Fix.

This is a copy of PR by @andreip

In his words:

Couldn't think of a different approach, since an img isn't really a block, so it'll never have a text within it, so no point in generating a different html in get_line_info functions. Instead, what was missing was it being treated as a special case: don't want to slice a line from the HTML by just looking at the plain text lines, since that could slice an img, need to also look at the start/end refs for replaced tags.

See more about a replaced element (https://developer.mozilla.org/en-US/docs/Web/CSS/Replaced_element). I think it might be worth adding a few more things to the list? e.g. video, embed etc. ; not sure about iframe and how that'd be treated in lxml parsing though, but I suppose you could have an iframe with just an image in it, in which case you'd still want to keep it?

Full list would be a total of 9 replaced elements (or 10 if we also count input; although I'm not sure of all examples where that'd generate sth even if it apparently has no text in it).

@afzalIbnSH afzalIbnSH merged commit 2593fc1 into fw-master Sep 16, 2021
@afzalIbnSH afzalIbnSH deleted the dont-ignore-images branch September 16, 2021 11:39
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.

1 participant