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/DTD/xhtml-datatypes-1.mod.1 | 103 +++++++ lv2specgen/DTD/xhtml-metaAttributes-1.mod | 154 ++++++++++ lv2specgen/DTD/xhtml-rdfa-1.dtd | 472 ++++++++++++++++++++++++++++++ lv2specgen/DTD/xhtml-rdfa-model-1.mod | 249 ++++++++++++++++ lv2specgen/lv2specgen.py | 13 + 5 files changed, 991 insertions(+) create mode 100644 lv2specgen/DTD/xhtml-datatypes-1.mod.1 create mode 100644 lv2specgen/DTD/xhtml-metaAttributes-1.mod create mode 100644 lv2specgen/DTD/xhtml-rdfa-1.dtd create mode 100644 lv2specgen/DTD/xhtml-rdfa-model-1.mod diff --git a/lv2specgen/DTD/xhtml-datatypes-1.mod.1 b/lv2specgen/DTD/xhtml-datatypes-1.mod.1 new file mode 100644 index 0000000..dde43e8 --- /dev/null +++ b/lv2specgen/DTD/xhtml-datatypes-1.mod.1 @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lv2specgen/DTD/xhtml-metaAttributes-1.mod b/lv2specgen/DTD/xhtml-metaAttributes-1.mod new file mode 100644 index 0000000..b434e39 --- /dev/null +++ b/lv2specgen/DTD/xhtml-metaAttributes-1.mod @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + +]]> + + + + +]]> + + + + +]]> + + + + +]]> + + + + +]]> + + + + +]]> + + + + +]]> + + + + +]]> + + + + + + + + +]]> + + + + + diff --git a/lv2specgen/DTD/xhtml-rdfa-1.dtd b/lv2specgen/DTD/xhtml-rdfa-1.dtd new file mode 100644 index 0000000..26ed117 --- /dev/null +++ b/lv2specgen/DTD/xhtml-rdfa-1.dtd @@ -0,0 +1,472 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + +%xhtml-datatypes.mod;]]> + + + + +%xhtml-metaAttributes.mod;]]> + + + + + + + + + + + +%xhtml-inlstyle.mod;]]> + + + + + + + +%xhtml-framework.mod;]]> + + + + + +]]> + + + + + + +%xhtml-text.mod;]]> + + + + + +%xhtml-hypertext.mod;]]> + + + + + +%xhtml-list.mod;]]> + + + + + + +%xhtml-edit.mod;]]> + + + + +%xhtml-bdo.mod;]]> + + + + + + +%xhtml-ruby.mod;]]> + + + + +%xhtml-pres.mod;]]> + + + + + +%xhtml-link.mod;]]> + + + + + + + +%xhtml-meta.mod;]]> + + + + + +%xhtml-base.mod;]]> + + + + + +%xhtml-script.mod;]]> + + + + + + + +%xhtml-style.mod;]]> + + + + + +%xhtml-image.mod;]]> + + + + + + +%xhtml-csismap.mod;]]> + + + + + + +%xhtml-ssismap.mod;]]> + + + + + +%xhtml-param.mod;]]> + + + + + +%xhtml-object.mod;]]> + + + + +%xhtml-table.mod;]]> + + + + +%xhtml-form.mod;]]> + + + + +%xhtml-target.mod;]]> + + + + +%xhtml-legacy.mod;]]> + + + + + + + +%xhtml-struct.mod;]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lv2specgen/DTD/xhtml-rdfa-model-1.mod b/lv2specgen/DTD/xhtml-rdfa-model-1.mod new file mode 100644 index 0000000..ad010ee --- /dev/null +++ b/lv2specgen/DTD/xhtml-rdfa-model-1.mod @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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