Skip to content

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

Open
@Mr0grog

Description

@Mr0grog

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}>')

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions