aboutsummaryrefslogtreecommitdiffstats
path: root/lv2specgen
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-03-20 23:28:58 +0100
committerDavid Robillard <d@drobilla.net>2020-03-28 17:10:05 +0100
commit59c3df529e9216eaeb7407980d9d580f8ba283dd (patch)
tree15375c6387da22c7412517cbb079a8b572233fe5 /lv2specgen
parentd87b8eab750f83b4f28eeaa1f00e25e7912fb839 (diff)
downloadlv2-59c3df529e9216eaeb7407980d9d580f8ba283dd.tar.xz
lv2specgen: Put restrictions in the same definition list
Diffstat (limited to 'lv2specgen')
-rwxr-xr-xlv2specgen/lv2specgen.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py
index 79c33e5..24cacd2 100755
--- a/lv2specgen/lv2specgen.py
+++ b/lv2specgen/lv2specgen.py
@@ -429,13 +429,16 @@ def getTermLink(uri, subject=None, predicate=None):
def owlRestrictionInfo(term, m):
"""Generate OWL restriction information for Classes"""
- doc = ""
-
restrictions = []
for s in findStatements(m, term, rdfs.subClassOf, None):
if findOne(m, getObject(s), rdf.type, owl.Restriction):
restrictions.append(getObject(s))
+ if not restrictions:
+ return ''
+
+ doc = '<dl>'
+
for r in sorted(restrictions):
props = findStatements(m, r, None, None)
onProp = None
@@ -446,7 +449,7 @@ def owlRestrictionInfo(term, m):
elif getPredicate(p) == rdfs.comment:
comment = getObject(p)
if onProp is not None:
- doc += '<dl><dt>Restriction on %s</dt>\n' % getTermLink(onProp)
+ doc += '<dt>Restriction on %s</dt>\n' % getTermLink(onProp)
prop_str = ''
for p in findStatements(m, r, None, None):
@@ -466,8 +469,9 @@ def owlRestrictionInfo(term, m):
if comment is not None:
prop_str += '\n<div>%s</div>\n' % getLiteralString(comment)
- doc += '<dd>%s</dd></dl>' % prop_str if prop_str else '';
+ doc += '<dd>%s</dd>' % prop_str if prop_str else '';
+ doc += '</dl>'
return doc
def rdfsClassInfo(term, m):