From c9c797900f247c80fada6bdabf4bee0aa3283341 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 24 Mar 2019 13:33:45 +0100 Subject: Fix pretty names for links within the current specification --- lv2specgen/lv2specgen.py | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) (limited to 'lv2specgen') diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py index c3ae71c..fe188ec 100755 --- a/lv2specgen/lv2specgen.py +++ b/lv2specgen/lv2specgen.py @@ -150,8 +150,8 @@ def isLiteral(n): def niceName(uri): global spec_bundle - if uri.startswith(spec_bundle): - return uri[len(spec_bundle):] + if uri.startswith(spec_ns_str): + return uri[len(spec_ns_str):] regexp = re.compile("^(.*[/#])([^/#]+)$") rez = regexp.search(uri) @@ -667,29 +667,19 @@ def docTerms(category, list, m, classlist, proplist, instalist): """ A wrapper class for listing all the terms in a specific class (either Properties, or Classes. Category is 'Property' or 'Class', list is a - list of term names (strings), return value is a chunk of HTML. + list of term URI strings, return value is a chunk of HTML. """ doc = "" nspre = spec_pre - for item in list: - t = termName(m, item) - if (t.startswith(spec_ns_str)) and ( - len(t[len(spec_ns_str):].split("/")) < 2): - term = t - t = t.split(spec_ns_str[-1])[1] - curie = "%s:%s" % (nspre, t) - else: - if t.startswith("http://"): - term = t - curie = getShortName(t) - t = getAnchor(t) - else: - term = spec_ns[t] - curie = "%s:%s" % (nspre, t) - - term_uri = term + for term in list: + if not term.startswith(spec_ns_str): + sys.stderr.write("warning: Skipping external term `%s'" % term) + continue - doc += """
\n

%s %s

\n""" % (t, term_uri, category, getAnchor(str(term_uri)), curie) + t = termName(m, term) + curie = term.split(spec_ns_str[-1])[1] + doc += '
' % (t, term) + doc += '

%s

' % (getAnchor(term), curie) label = getLabel(m, term) comment = getComment(m, term, classlist, proplist, instalist) -- cgit v1.2.1