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

html_render: Highlighting is not preserving attributes on inline elements that get split up #78

Open
Mr0grog opened this issue Jul 28, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@Mr0grog
Copy link
Member

Mr0grog commented Jul 28, 2021

This diff: https://monitoring.envirodatagov.org/page/671a2a65-b716-4603-8d84-0f88eac21f59/d180ac05-0957-472b-ba8e-66a8e46ca3e9..1e0e4c85-c70b-4e6a-ad3e-3c6ee48e4d6d

appears to be causing some funky formatting because it isn't including all the correct attributes on inline elements that get broken up by the <ins>/<del> that the diff inserts.

Screen Shot 2021-07-28 at 12 53 09 PM

In this example, the original content is a <p> with all its text wrapped in a nested set of <span> elements with inline style attributes. However, in the diff, <ins> elements break up those spans, and only the first set retain the attributes:

Screen Shot 2021-07-28 at 12 55 01 PM

I think we just need to take care to preserve the attributes in two spots, but this definitely needs more investigation:

current_content.reverse()
for nested_tag in current_content:
doc.append(f'<{nested_tag}>')

and:

current_content.reverse()
for nested_tag in current_content:
group.append(f'<{nested_tag}>')

@Mr0grog Mr0grog added the bug Something isn't working label Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant