aboutsummaryrefslogtreecommitdiffstats
path: root/lv2specgen
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-09 01:17:56 +0000
committerDavid Robillard <d@drobilla.net>2013-01-09 01:17:56 +0000
commitb73784ea11af64f1e655637aa2012f454748a87f (patch)
treedf248e767b653919a3484048cd7c00e84609517f /lv2specgen
parentc0a049f186fd48915e605ec30456090e471cbfb9 (diff)
downloadlv2-b73784ea11af64f1e655637aa2012f454748a87f.tar.xz
Fix lv2specgen usage from command line.
Fix round-trip UTF-8 support in lv2specgen. Support specifications with URI equivalent to prefix and/or slash namespaces.
Diffstat (limited to 'lv2specgen')
-rwxr-xr-xlv2specgen/lv2specgen.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py
index 28a84db..efa5c60 100755
--- a/lv2specgen/lv2specgen.py
+++ b/lv2specgen/lv2specgen.py
@@ -1092,7 +1092,9 @@ def specgen(specloc, indir, style_uri, docdir, tags, instances=False, offline=Fa
if uri.startswith('file:'):
continue;
ns_list[str(uri)] = i
- if str(uri) == spec_url + '#':
+ if (str(uri) == spec_url + '#' or
+ str(uri) == spec_url + '/' or
+ str(uri) == spec_url):
spec_pre = i
prefixes_html += '<a href="%s">%s</a> ' % (uri, i)
prefixes_html += "</span>"
@@ -1137,7 +1139,7 @@ def specgen(specloc, indir, style_uri, docdir, tags, instances=False, offline=Fa
template = template.replace('@BASE@', spec_ns_str)
template = template.replace('@AUTHORS@', specAuthors(m, spec))
template = template.replace('@INDEX@', azlist)
- template = template.replace('@REFERENCE@', termlist.encode("utf-8"))
+ template = template.replace('@REFERENCE@', termlist)
template = template.replace('@FILENAME@', filename)
template = template.replace('@HEADER@', basename + '.h')
template = template.replace('@MAIL@', 'devel@lists.lv2plug.in')
@@ -1204,7 +1206,7 @@ def specgen(specloc, indir, style_uri, docdir, tags, instances=False, offline=Fa
def save(path, text):
try:
f = open(path, "w")
- f.write(text)
+ f.write(text.encode("utf-8"))
f.flush()
f.close()
except Exception:
@@ -1286,7 +1288,7 @@ if __name__ == "__main__":
i += 1
try:
- save(output, specgen(specloc, indir, style, docdir, tags, instances=instances))
+ save(output, specgen(ontology, indir, style, docdir, tags, instances=instances))
except:
e = sys.exc_info()[1]
print('error: ' + str(e))