1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-22 01:14:21 +01:00

html_tidy cleanup

This commit is contained in:
kakwa 2019-02-09 18:54:35 +01:00
parent 98fca30fba
commit 046afbbe29

View File

@ -81,15 +81,15 @@ class HtmlValidationFailed(Exception):
self.errors = out self.errors = out
def _is_html_error(line): def _is_html_error(line):
ret = True
for p in [ for p in [
r'.*Warning: trimming empty <span>.*', r'.*Warning: trimming empty <span>.*',
r'.*Error: <nav> is not recognized!.*', r'.*Error: <nav> is not recognized!.*',
r'.*Warning: discarding unexpected <nav>.*', r'.*Warning: discarding unexpected <nav>.*',
r'.*testing: good.*',
]: ]:
if re.match(p, line): if re.match(p, line):
ret = False return False
return ret return True
def htmlvalidator(page): def htmlvalidator(page):
document, errors = tidy_document(page, document, errors = tidy_document(page,
@ -97,7 +97,11 @@ def htmlvalidator(page):
f = tempfile() f = tempfile()
for line in errors.splitlines(): for line in errors.splitlines():
if _is_html_error(line): if _is_html_error(line):
print(line) print("################")
print("Blocking error: '%s'" % line)
print("all tidy_document errors:"
print(errors)
print("################")
raise HtmlValidationFailed(line) raise HtmlValidationFailed(line)
class BadModule(): class BadModule():