]> git.lyx.org Git - lyx.git/commitdiff
Simplify simplehtml_validity.py
authorThibaut Cuvelier <tcuvelier@lyx.org>
Mon, 9 Jan 2023 03:16:34 +0000 (04:16 +0100)
committerThibaut Cuvelier <tcuvelier@lyx.org>
Mon, 9 Jan 2023 16:16:40 +0000 (17:16 +0100)
development/autotests/simplehtml_validity.py

index 0cc71f30d23a37fb35e8ce62faa0846bf67b8451..896b4a29fca1553180916dd003b7507d0bc16fcc 100644 (file)
 # Run:
 #     pip install html5validator>=0.4.2
 
-import collections
-import glob
 import sys
-import tempfile
 import os
 
 import html5validator
 
 
 if len(sys.argv) != 2:
-    print('Expecting one argument, the path to the LyX-create xhtml file')
+    print('Expecting one argument, the path to the LyX-created XHTML file')
     sys.exit(-1)
 if not os.path.exists(sys.argv[1]):
     print('The given path does not point to an existing file')
@@ -35,19 +32,9 @@ xhtml_list = [xhtml_file_name]
 validator = html5validator.Validator(format='text')
 error_count = validator.validate(xhtml_list)
 
-n_invalid = 0
-n_valid = 0
 if error_count == 0:
-    n_valid += 1
-    print(f'> Found no validation error!')
+    print('> Found no validation error!')
     sys.exit(0)
 else:
-    n_invalid += 1
-    print(f'> Found {error_count} validation error{"" if error_count == 1 else "s"}!')
+    print('> Found a validation error!')
     sys.exit(-2)
-
-if n_invalid == 0:
-    print("That's excellent! Give yourself a pat on the back!")
-    sys.exit(0)
-else:
-    sys.exit(-3)