Skip to content

Commit

Permalink
feat(parser): trim linebreaks between blockquote&p
Browse files Browse the repository at this point in the history
Signed-off-by: Rongrong <[email protected]>
  • Loading branch information
Rongronggg9 committed Nov 5, 2023
1 parent 157aa49 commit 8b2753a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/parsing/html_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,13 @@ async def _parse_item(self, soup: Union[PageElement, BeautifulSoup, Tag, Navigab
if text:
if parent == 'li':
return text
text_l = [Br(), text]
if not(isinstance(soup.next_sibling, Tag) and soup.next_sibling.name == 'blockquote'):
text_l = [text]
ps, ns = soup.previous_sibling, soup.next_sibling
if not (isinstance(ps, Tag) and ps.name == 'blockquote'):
text_l.insert(0, Br())
if not (isinstance(ns, Tag) and ns.name == 'blockquote'):
text_l.append(Br())
return Text(text_l)
return Text(text_l) if len(text_l) > 1 else text
return None

if tag == 'blockquote':
Expand Down

0 comments on commit 8b2753a

Please sign in to comment.