removed unused html2txt

This commit is contained in:
Emmanuel Viennet 2021-07-11 18:04:44 +02:00
parent a565fffe2f
commit 2bc3dc66a3

View File

@ -717,44 +717,6 @@ if WITH_PYDOT:
return g.get_node(name) return g.get_node(name)
from sgmllib import SGMLParser
class html2txt_parser(SGMLParser):
"""html2txt()"""
def reset(self):
"""reset() --> initialize the parser"""
SGMLParser.reset(self)
self.pieces = []
def handle_data(self, text):
"""handle_data(text) --> appends the pieces to self.pieces
handles all normal data not between brackets "<>"
"""
self.pieces.append(text)
def handle_entityref(self, ref):
"""called for each entity reference, e.g. for "&copy;", ref will be
"copy"
Reconstruct the original entity reference.
"""
if ref == "amp":
self.pieces.append("&")
def output(self):
"""Return processed HTML as a single string"""
return " ".join(self.pieces)
def scodoc_html2txt(html):
parser = html2txt_parser()
parser.reset()
parser.feed(html)
parser.close()
return parser.output()
def is_valid_mail(email): def is_valid_mail(email):
"""True if well-formed email address""" """True if well-formed email address"""
return re.match(r"^.+@.+\..{2,3}$", email) return re.match(r"^.+@.+\..{2,3}$", email)