From 8c5541cbe44d10769cc4d6c72c9cb142ca7a4c20 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 24 Mar 2019 19:33:11 +0100 Subject: Add validation for complete specification page --- lv2specgen/lv2specgen.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lv2specgen/lv2specgen.py') diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py index e280b25..1b6400e 100755 --- a/lv2specgen/lv2specgen.py +++ b/lv2specgen/lv2specgen.py @@ -1386,6 +1386,19 @@ def specgen(specloc, indir, style_uri, docdir, tags, opts, instances=False, root if index_path is not None: writeIndex(m, specloc, index_path, root_path, root_uri) + # Validate complete output page + try: + oldcwd = os.getcwd() + os.chdir(specgendir) + root = etree.fromstring( + template.replace('"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"', + '"DTD/xhtml-rdfa-1.dtd"').encode('utf-8'), + etree.XMLParser(dtd_validation=True, no_network=True)) + except Exception as e: + sys.stderr.write("error: Validation failed for %s: %s" % (specloc, e)) + finally: + os.chdir(oldcwd) + return template -- cgit v1.2.1