-
Notifications
You must be signed in to change notification settings - Fork 0
Add support for intentionally empty tags #1
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
base: main
Are you sure you want to change the base?
Conversation
danblaker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should merge this until it uses a generic approach, e.g. support for diffing specified attributes, rather than OUR-specific tags.
pvande
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know frustratingly little about how this is implemented or how it is being used, so I don't feel confident speaking to whether this is fit for purpose or an ideal approach.
I will note that there is no testing around this change, which we should probably remedy before merging — that will at minimum allow us to refactor things in the future, if a better approach reveals itself.
Some scenarios involving intentionally blank tags were resulting in mismatched HTML, after being diffed, like a LaTex
spanfollowed by a writing blankspanthat is then replaced by a second LaTexspan. This branch adds support for tags that are intentionally left empty by treating them as unified "words" to be diffed as a whole.It also adds an optional
compare_tag_attributesargument to be used in thesame_tag?method on theOperationsclass. Previously, tags with the same name and different attributes were always treated as "equal" when being diffed, resulting in unpredictable outcomes when, for example, a writing blankspanis replaced by a latexspan', or an embedded image is replaced by a different image (where the only tag difference is thesrcattribute). Optionally passing incompare_tag_attributes` allows us to treat tags with different attributes as entirely different content when necessary.