aboutsummaryrefslogtreecommitdiffstats
path: root/lv2specgen
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-07-16 22:29:40 -0400
committerDavid Robillard <d@drobilla.net>2022-07-17 18:14:02 -0400
commit666fc60b6e332cee4389cae0f06b50cb764edd1c (patch)
tree04c49208ed48e6ee71124f65f193a40da85ae13a /lv2specgen
parente1c80a39b280509007693225abb2eb9d47ac01e1 (diff)
downloadlv2-666fc60b6e332cee4389cae0f06b50cb764edd1c.tar.xz
Use the same set of external vocabulary prefixes everywhere
The RDFa in specification pages doesn't actually use prefixed names for the documented resources. So, simplify things by trimming the namespaces down to a consistent set that is actually used in the LV2 universe.
Diffstat (limited to 'lv2specgen')
-rw-r--r--lv2specgen/DTD/xhtml-rdfa-1.dtd40
-rwxr-xr-xlv2specgen/lv2specgen.py22
-rw-r--r--lv2specgen/template.html8
3 files changed, 21 insertions, 49 deletions
diff --git a/lv2specgen/DTD/xhtml-rdfa-1.dtd b/lv2specgen/DTD/xhtml-rdfa-1.dtd
index dcfbf09..bd3479e 100644
--- a/lv2specgen/DTD/xhtml-rdfa-1.dtd
+++ b/lv2specgen/DTD/xhtml-rdfa-1.dtd
@@ -437,36 +437,18 @@
<!-- end of XHTML-RDFa DTD ................................................ -->
<!-- ....................................................................... -->
-<!-- Add xmlns attributes to validate lv2specgen output -->
-<!-- This is a pretty dirty hack, but avoids needing to write a bunch of code to
- mangle DTDs to appease validation -->
+<!-- Hack for lv2specgen: declare prefixes for the external vocabularies used
+ in LV2 (most of which are generally common for RDF), so RDFa in spec pages
+ can use prefixed names. This glaring separation-of-concerns violation
+ is... not nice, but neither is diving into the horrors of custom XML DTD
+ validation, so here we are.
+-->
-<!ATTLIST html xmlns:dc CDATA #IMPLIED>
+<!ATTLIST html xmlns:dcs CDATA #IMPLIED>
<!ATTLIST html xmlns:dcterms CDATA #IMPLIED>
+<!ATTLIST html xmlns:doap CDATA #IMPLIED>
+<!ATTLIST html xmlns:foaf CDATA #IMPLIED>
+<!ATTLIST html xmlns:owl CDATA #IMPLIED>
<!ATTLIST html xmlns:rdf CDATA #IMPLIED>
<!ATTLIST html xmlns:rdfs CDATA #IMPLIED>
-
-<!ATTLIST html xmlns:atom CDATA #IMPLIED>
-<!ATTLIST html xmlns:bufsz CDATA #IMPLIED>
-<!ATTLIST html xmlns:da CDATA #IMPLIED>
-<!ATTLIST html xmlns:dman CDATA #IMPLIED>
-<!ATTLIST html xmlns:ev CDATA #IMPLIED>
-<!ATTLIST html xmlns:ia CDATA #IMPLIED>
-<!ATTLIST html xmlns:log CDATA #IMPLIED>
-<!ATTLIST html xmlns:lv2 CDATA #IMPLIED>
-<!ATTLIST html xmlns:midi CDATA #IMPLIED>
-<!ATTLIST html xmlns:morph CDATA #IMPLIED>
-<!ATTLIST html xmlns:opts CDATA #IMPLIED>
-<!ATTLIST html xmlns:param CDATA #IMPLIED>
-<!ATTLIST html xmlns:patch CDATA #IMPLIED>
-<!ATTLIST html xmlns:pg CDATA #IMPLIED>
-<!ATTLIST html xmlns:pprops CDATA #IMPLIED>
-<!ATTLIST html xmlns:pset CDATA #IMPLIED>
-<!ATTLIST html xmlns:rsz CDATA #IMPLIED>
-<!ATTLIST html xmlns:state CDATA #IMPLIED>
-<!ATTLIST html xmlns:time CDATA #IMPLIED>
-<!ATTLIST html xmlns:ui CDATA #IMPLIED>
-<!ATTLIST html xmlns:umap CDATA #IMPLIED>
-<!ATTLIST html xmlns:units CDATA #IMPLIED>
-<!ATTLIST html xmlns:urid CDATA #IMPLIED>
-<!ATTLIST html xmlns:work CDATA #IMPLIED>
+<!ATTLIST html xmlns:xsd CDATA #IMPLIED>
diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py
index a07bdf3..a37ad32 100755
--- a/lv2specgen/lv2specgen.py
+++ b/lv2specgen/lv2specgen.py
@@ -86,20 +86,14 @@ spec_pre = None
spec_bundle = None
specgendir = None
ns_list = {
+ "http://ontologi.es/doap-changeset#": "dcs",
+ "http://purl.org/dc/terms/": "dcterms",
+ "http://usefulinc.com/ns/doap#": "doap",
+ "http://xmlns.com/foaf/0.1/": "foaf",
+ "http://www.w3.org/2002/07/owl#": "owl",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf",
"http://www.w3.org/2000/01/rdf-schema#": "rdfs",
- "http://www.w3.org/2002/07/owl#": "owl",
"http://www.w3.org/2001/XMLSchema#": "xsd",
- "http://rdfs.org/sioc/ns#": "sioc",
- "http://xmlns.com/foaf/0.1/": "foaf",
- "http://purl.org/dc/elements/1.1/": "dc",
- "http://purl.org/dc/terms/": "dcterms",
- "http://purl.org/rss/1.0/modules/content/": "content",
- "http://www.w3.org/2003/01/geo/wgs84_pos#": "geo",
- "http://www.w3.org/2004/02/skos/core#": "skos",
- "http://lv2plug.in/ns/lv2core#": "lv2",
- "http://usefulinc.com/ns/doap#": "doap",
- "http://ontologi.es/doap-changeset#": "dcs",
}
rdf = rdflib.Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#")
@@ -1377,12 +1371,6 @@ def specgen(
)
template = template.replace("@URI@", spec)
template = template.replace("@PREFIX@", spec_pre)
- if spec_pre == "lv2":
- template = template.replace("@XMLNS@", "")
- else:
- template = template.replace(
- "@XMLNS@", 'xmlns:%s="%s"' % (spec_pre, spec_ns_str)
- )
filename = os.path.basename(specloc)
basename = os.path.splitext(filename)[0]
diff --git a/lv2specgen/template.html b/lv2specgen/template.html
index 879a109..4eb3d96 100644
--- a/lv2specgen/template.html
+++ b/lv2specgen/template.html
@@ -2,12 +2,14 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html about="@URI@"
xmlns="http://www.w3.org/1999/xhtml"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dcs="http://ontologi.es/doap-changeset#"
xmlns:dcterms="http://purl.org/dc/terms/"
+ xmlns:doap="http://usefulinc.com/ns/doap#"
+ xmlns:foaf="http://xmlns.com/foaf/0.1/"
+ xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
- xmlns:lv2="http://lv2plug.in/ns/lv2core#"
- @XMLNS@
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xml:lang="en">
<head>
<title>@TITLE@</title>