From 2bc3dc66a3ad8f39ce5cd1856812d9210cf1d53d Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 11 Jul 2021 18:04:44 +0200 Subject: [PATCH] removed unused html2txt --- app/scodoc/sco_utils.py | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/app/scodoc/sco_utils.py b/app/scodoc/sco_utils.py index 3f83e0188..797809d81 100644 --- a/app/scodoc/sco_utils.py +++ b/app/scodoc/sco_utils.py @@ -717,44 +717,6 @@ if WITH_PYDOT: 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 "©", 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): """True if well-formed email address""" return re.match(r"^.+@.+\..{2,3}$", email)