From 59c3df529e9216eaeb7407980d9d580f8ba283dd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 20 Mar 2020 23:28:58 +0100 Subject: lv2specgen: Put restrictions in the same definition list --- lv2specgen/lv2specgen.py | 12 ++++++++---- 1 file 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 = '
' + 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 += '
Restriction on %s
\n' % getTermLink(onProp) + doc += '
Restriction on %s
\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
%s
\n' % getLiteralString(comment) - doc += '
%s
' % prop_str if prop_str else ''; + doc += '
%s
' % prop_str if prop_str else ''; + doc += '
' return doc def rdfsClassInfo(term, m): -- cgit v1.2.1