8000 Fix minor regression in li/p code · python/peps@0483974 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0483974

Browse files
committed
Fix minor regression in li/p code
1 parent 560e3d4 commit 0483974

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

package.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@
2424

2525
# Removes <p> tags from list item elements
2626
for tag in contents.findAll("li"):
27-
try:
27+
if tag.p and len(tag.contents) == 1:
28+
tag.p.unwrap()
29+
elif "ul" in [t.name for t in tag.contents]:
2830
tag.p.unwrap()
29-
except AttributeError 53FA :
30-
# If no <p> tag to unwrap
31-
pass
3231

3332
# Removes all permalink elements
3433
[tag.decompose() for tag in contents.findAll(class_="headerlink")]

0 commit comments

Comments
 (0)
0