mirror of
https://github.com/wassname/FanFicFare.git
synced 2026-09-10 11:40:24 +08:00
Convert replace_br_with_p module to BS4.
This commit is contained in:
@@ -19,7 +19,7 @@ import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
import re
|
||||
import codecs
|
||||
import BeautifulSoup as bs
|
||||
import bs4 as bs
|
||||
import HtmlTagStack as stack
|
||||
|
||||
from . import exceptions as exceptions
|
||||
@@ -147,7 +147,7 @@ def replace_br_with_p(body):
|
||||
contentLinesSum += lineLen
|
||||
if lineLen > longestLineLength:
|
||||
longestLineLength = lineLen
|
||||
|
||||
|
||||
if contentLines == 0:
|
||||
contentLines = 1
|
||||
|
||||
@@ -258,7 +258,7 @@ def soup_up_div(body):
|
||||
|
||||
body = body.replace(u'<br />', u'[br /]')
|
||||
|
||||
soup = bs.BeautifulSoup(body)
|
||||
soup = bs.BeautifulSoup(body,'html5lib')
|
||||
|
||||
body = u''
|
||||
lastElement = 1 # 1 = block, 2 = nested, 3 = invalid
|
||||
|
||||
Reference in New Issue
Block a user