We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9dd41bb commit d4b9dd7Copy full SHA for d4b9dd7
1 file changed
telegraph/utils.py
@@ -39,6 +39,9 @@ def __init__(self):
39
self.parent_nodes = []
40
41
def add_str_node(self, s):
42
+ if not s:
43
+ return
44
+
45
if self.current_nodes and isinstance(self.current_nodes[-1], basestring):
46
self.current_nodes[-1] += s
47
else:
@@ -75,10 +78,7 @@ def handle_endtag(self, tag):
75
78
last_node.pop('children')
76
79
77
80
def handle_data(self, data):
- if data == '\n':
- return
-
81
- self.add_str_node(data)
+ self.add_str_node(data.strip())
82
83
def handle_entityref(self, name):
84
self.add_str_node(chr(name2codepoint[name]))
0 commit comments