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

WIP: Add optimization that prunes nested <g>-tags #244

Closed
wants to merge 3 commits into from

Conversation

nthykier
Copy link
Contributor

An optimization that prunes nested -tags when they contain exactly one and nothing else (except whitespace nodes). This looks a bit like removeNestedGroups except it only touches tags without attributes (but can remove -tags completely from a tree, whereas this optimization always leaves at least one tag behind).

Closes: #215

Both `mergeSiblingGroupsWithCommonAttributes` and `removeNestedGroups`
used the same code in different forms.  Extract it into its own
function.

Signed-off-by: Niels Thykier <niels@thykier.net>
If someone gave it an ID and we have not stripped it, then it is
probably important and can alter the output somehow if we fiddle merge
it into another node (or discard the <g> node with an ID).

Signed-off-by: Niels Thykier <niels@thykier.net>
@nthykier
Copy link
Contributor Author

(have seen the flake error, will look at it later)

An optimization that prunes nested <g>-tags when they contain exactly
one <g> and nothing else (except whitespace nodes).  This looks a bit
like `removeNestedGroups` except it only touches <g> tags without
attributes (but can remove <g>-tags completely from a tree, whereas
this optimization always leaves at least one <g> tag behind).

Closes: scour-project#215
Signed-off-by: Niels Thykier <niels@thykier.net>
@nthykier nthykier changed the title Add optimization that prunes nested <g>-tags WIP: Add optimization that prunes nested <g>-tags May 18, 2020
@nthykier
Copy link
Contributor Author

I need to follow up on something before it can be merged.

@nthykier nthykier closed this May 21, 2020
@nthykier nthykier deleted the collapse-g-tags branch January 10, 2021 11:17
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.

group-collapsing
1 participant