Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.drop_white_space = 0
self.inheader = False
self.abbr_title = None # current abbreviation definition
self.abbr_data = None # last inner HTML (for abbr being defined)
self.abbr_list = {} # stack of abbreviations to write later
self.baseurl = baseurl
self.stressed = False
self.preceding_stressed = False
self.preceding_data = None
self.current_tag = None
try:
del unifiable_n[name2cp('nbsp')]
except KeyError:
pass
config.UNIFIABLE['nbsp'] = ' _place_holder;'
def entityref(self, c):
if not self.unicode_snob and c in config.UNIFIABLE.keys():
return config.UNIFIABLE[c]
else:
try:
name2cp(c)
except KeyError:
return "&" + c + ';'
else:
if c == 'nbsp':
return config.UNIFIABLE[c]
else:
return chr(name2cp(c))
import sys
from html2text import config
from html2text.compat import htmlentitydefs
def name2cp(k):
"""Return sname to codepoint"""
if k == 'apos':
return ord("'")
return htmlentitydefs.name2codepoint[k]
unifiable_n = {}
for k in config.UNIFIABLE.keys():
unifiable_n[name2cp(k)] = config.UNIFIABLE[k]
def hn(tag):
if tag[0] == 'h' and len(tag) == 2:
try:
n = int(tag[1])
if n in range(1, 10): # pragma: no branch
return n
except ValueError:
return 0
def dumb_property_dict(style):
"""
:returns: A hash of css attributes
"""