Commit 15bedb88 authored by jvoisin's avatar jvoisin


parent da1d7aa5
Pipeline #22552 failed with stage
in 2 minutes and 58 seconds
from html import parser
import logging
from typing import Dict, Any, List, Tuple
from . import abstract
......@@ -45,8 +46,10 @@ class _HTMLParser(parser.HTMLParser):
def handle_endtag(self, tag: str):
if not self.__validation_queue:
logging.error('MEH: %s' % self.__validation_queue)
raise ValueError
elif tag != self.__validation_queue.pop():
logging.error('POUET: %s' % self.__validation_queue)
raise ValueError
elif tag in self.tag_blacklist:
self.__in_dangerous_tag -= 1
......@@ -71,6 +74,7 @@ class _HTMLParser(parser.HTMLParser):
def remove_all(self, output_filename: str) -> bool:
if self.__validation_queue:
logging.error('Invalid: %s' % self.__validation_queue)
raise ValueError
with open(output_filename, 'w') as f:
......@@ -78,5 +82,6 @@ class _HTMLParser(parser.HTMLParser):
def get_meta(self) -> Dict[str, Any]:
if self.__validation_queue:
logging.error('Nope: %s' % self.__validation_queue)
raise ValueError
return self.__meta
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment