diff options
author | David Robillard <d@drobilla.net> | 2012-02-28 19:03:15 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-02-28 19:03:15 +0000 |
commit | 99e17726280eb0dc685c75757468771727e35981 (patch) | |
tree | 250fa99a80a8ea20ce818b3ebaf4e823c743ee4c /lv2specgen | |
parent | 359ccc7ff02e41c5b1a5672700cf89ec6b9d9032 (diff) | |
download | lv2-99e17726280eb0dc685c75757468771727e35981.tar.xz |
Fix documentation links.
Diffstat (limited to 'lv2specgen')
-rwxr-xr-x | lv2specgen/lv2specgen.py | 48 |
1 files changed, 15 insertions, 33 deletions
diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py index edef5ea..d85a626 100755 --- a/lv2specgen/lv2specgen.py +++ b/lv2specgen/lv2specgen.py @@ -976,7 +976,7 @@ def getInstances(model, classes, properties): instances.append(getSubject(i)) return instances -def load_tags(path, doc_base, doc_prefix): +def load_tags(path, docdir): "Build a (symbol => URI) map from a Doxygen tag file." def getChildText(elt, tagname): @@ -987,7 +987,7 @@ def load_tags(path, doc_base, doc_prefix): return '' def linkTo(sym, url): - return '<span><a href="%s/%s">%s</a></span>' % (doc_base, url, sym) + return '<span><a href="%s/%s">%s</a></span>' % (docdir, url, sym) tagdoc = xml.dom.minidom.parse(path) root = tagdoc.documentElement @@ -1001,7 +1001,7 @@ def load_tags(path, doc_base, doc_prefix): name = getChildText(cn, 'name') filename = getChildText(cn, 'filename') - linkmap[name] = linkTo(name, doc_prefix + filename) + linkmap[name] = linkTo(name, filename) prefix = '' if cn.getAttribute('kind') != 'file': @@ -1013,11 +1013,11 @@ def load_tags(path, doc_base, doc_prefix): mafile = getChildText(m, 'anchorfile') manchor = getChildText(m, 'anchor') linkmap[mname] = linkTo( - mname, '%s%s#%s' % (doc_prefix, mafile, manchor)) + mname, '%s#%s' % (mafile, manchor)) return linkmap -def specgen(specloc, indir, docdir, style_uri, doc_base, doc_prefix, tags, instances=False, mode="spec"): +def specgen(specloc, indir, style_uri, docdir, tags, instances=False, mode="spec"): """The meat and potatoes: Everything starts here.""" global spec_url @@ -1037,7 +1037,7 @@ def specgen(specloc, indir, docdir, style_uri, doc_base, doc_prefix, tags, insta template = f.read() # Load code documentation link map from tags file - linkmap = load_tags(tags, doc_base, doc_prefix) + linkmap = load_tags(tags, docdir) m = rdflib.ConjunctiveGraph() manifest_path = os.path.join(os.path.dirname(specloc), 'manifest.ttl') @@ -1236,14 +1236,13 @@ def getOntologyNS(m): def usage(): script = os.path.basename(sys.argv[0]) - print("""Usage: %s ONTOLOGY INDIR STYLE OUTPUT BASE TAGS [FLAGS] + print("""Usage: %s ONTOLOGY INDIR STYLE OUTPUT DOCDIR TAGS [FLAGS] ONTOLOGY : Path to ontology file INDIR : Input directory containing template.html and style.css STYLE : Stylesheet URI OUTPUT : HTML output path - DOCBASE : Documentation output base URI - DOCPREFIX : Documentation link prefix + DOCDIR : Doxygen HTML directory TAGS : Doxygen tags file Optional flags: @@ -1263,29 +1262,12 @@ if __name__ == "__main__": if (len(args) < 3): usage() else: - - # Ontology - specloc = "file:" + str(args[0]) - - # Input directory - indir = args[1] - - # Style - style_uri = args[2] - - # Destination - dest = args[3] - - # Doxygen documentation directory - doc_base = args[4] - - # Documentation link prefix - doc_prefix = args[5] - - # Doxygen tags file - doc_tags = args[6] - - docdir = os.path.join(doc_base, 'ns', 'doc') + ontology = "file:" + str(args[0]) + indir = args[1] + style = args[2] + output = args[3] + docdir = args[4] + tags = args[5] # Flags instances = False @@ -1301,7 +1283,7 @@ if __name__ == "__main__": i += 1 try: - save(dest, specgen(specloc, indir, docdir, style_uri, doc_base, doc_prefix, tags, instances=instances)) + save(output, specgen(specloc, indir, style, docdir, tags, instances=instances)) except: e = sys.exc_info()[1] print('error: ' + str(e)) |