File tree 3 files changed +6
-3
lines changed
3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ Version 2.1.5
3
3
4
4
Unreleased
5
5
6
+ - Fix ``striptags `` not collapsing spaces. :issue: `417 `
7
+
6
8
7
9
Version 2.1.4
8
10
-------------
Original file line number Diff line number Diff line change @@ -158,8 +158,7 @@ def striptags(self) -> str:
158
158
>>> Markup("Main »\t <em>About</em>").striptags()
159
159
'Main » About'
160
160
"""
161
- # collapse spaces
162
- value = " " .join (self .split ())
161
+ value = str (self )
163
162
164
163
# Look for comments then tags separately. Otherwise, a comment that
165
164
# contains a tag would end early, leaving some of the comment behind.
@@ -193,6 +192,8 @@ def striptags(self) -> str:
193
192
194
193
value = f"{ value [:start ]} { value [end + 1 :]} "
195
194
195
+ # collapse spaces
196
+ value = " " .join (value .split ())
196
197
return self .__class__ (value ).unescape ()
197
198
198
199
@classmethod
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ def test_escaping(escape):
73
73
Markup (
74
74
"<!-- outer comment -->"
75
75
"<em>Foo & Bar"
76
- "<!-- inner comment about <em> -->"
76
+ " <!-- inner comment about <em> -->\n "
77
77
"</em>"
78
78
"<!-- comment\n with\n newlines\n -->"
79
79
"<meta content='tag\n with\n newlines'>"
You can’t perform that action at this time.
0 commit comments