Closed phoerious closed 3 years ago
Moreover, the whole behaviour of this parameter is somewhat wonky and unpredictable depending on where white space appears.
It behaves similarly to Python's strip
, but for each node. It prevents from extra spaces for a lot of general cases.
When I call
text(strip=True)
on the root tree object, thestrip
parameter is not being passed on to the body tag object. Here's the code inparser.pyx
:So
tree.text(strip=True)
isn't working, but an explicittree.body(strip=True)
is.Moreover, the whole behaviour of this parameter is somewhat wonky and unpredictable depending on where white space appears.
gives
where only trailing white space is clipped, whereas
gives
which is more like what I'd expect, but it strips whitespaces completely and doesn't simply collapse it to a single space.