Commits

Anonymous committed 877dca2

Don't drop .tail with --filter

Comments (0)

Files changed (1)

anolislib/processes/filter.py

         return
     selector = cssselect.CSSSelector(kwargs["filter"])
     for element in selector(ElementTree.getroot()):
-        element.getparent().remove(element)
+        previous = element.getprevious()
+        parent = element.getparent()
+        if previous != None:
+            previous.tail = previous.tail + element.tail
+        else:
+            parent.text = parent.text + element.tail
+        parent.remove(element)