migration-orm-fixes
This commit is contained in:
@@ -535,8 +535,7 @@ class HTML2Text(html.parser.HTMLParser):
|
||||
if start:
|
||||
if 'data-original-title' in attrs:
|
||||
# WARNING: old discours specific code
|
||||
if 'import Tooltip' not in self.outtextlist[0]: self.outtextlist.insert(0, 'import Tooltip from "$/components/Article/Tooltip"\n\n')
|
||||
self.o('///%s///' % attrs['data-original-title'])
|
||||
self.o('&&&%s&&&' % attrs['data-original-title'])
|
||||
else:
|
||||
if (
|
||||
"href" in attrs
|
||||
@@ -1033,10 +1032,10 @@ class HTML2Text(html.parser.HTMLParser):
|
||||
return result
|
||||
|
||||
|
||||
def html2text(html: str, baseurl: str = "", bodywidth: Optional[int] = None) -> str:
|
||||
if bodywidth is None:
|
||||
bodywidth = config.BODY_WIDTH
|
||||
h = HTML2Text(baseurl=baseurl, bodywidth=bodywidth)
|
||||
|
||||
h = h.handle(html)
|
||||
def html2text(html: str, baseurl: str = "", bodywidth: Optional[int] = config.BODY_WIDTH) -> str:
|
||||
h = html.strip() or ''
|
||||
if h:
|
||||
h = HTML2Text(baseurl=baseurl, bodywidth=bodywidth)
|
||||
h = h.handle(html.strip())
|
||||
print('[html2text] %d bytes' % len(html))
|
||||
return h
|
||||
|
@@ -7,7 +7,7 @@ UNICODE_SNOB = True
|
||||
TABLE_MARKER_FOR_PAD = "special_marker_for_table_padding"
|
||||
# Escape all special characters. Output is less readable, but avoids
|
||||
# corner case formatting issues.
|
||||
ESCAPE_SNOB = False
|
||||
ESCAPE_SNOB = True
|
||||
|
||||
# Put the links after each paragraph instead of at the end.
|
||||
LINKS_EACH_PARAGRAPH = False
|
||||
@@ -46,10 +46,10 @@ IMAGES_AS_HTML = False
|
||||
IMAGES_TO_ALT = False
|
||||
IMAGES_WITH_SIZE = False
|
||||
IGNORE_EMPHASIS = False
|
||||
MARK_CODE = False
|
||||
MARK_CODE = True
|
||||
DECODE_ERRORS = "strict"
|
||||
DEFAULT_IMAGE_ALT = ""
|
||||
PAD_TABLES = False
|
||||
PAD_TABLES = True
|
||||
|
||||
# Convert links with same href and text to <href> format
|
||||
# if they are absolute links
|
||||
|
Reference in New Issue
Block a user