Commits

ms2ger  committed 10f0f12 Merge

Merged in zcorpan/anolis/fix-filter-drops-tail (pull request #7)

Don't drop .tail with --filter

  • Participants
  • Parent commits 30e2ec3, 877dca2

Comments (0)

Files changed (1)

File 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)