aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-04-26 17:18:49 +0200
committerDavid Robillard <d@drobilla.net>2020-04-26 17:18:49 +0200
commit0976ea4ea523e7ba534968e35b9bfeb6b9cb5482 (patch)
tree4a16e9c9caa1c090575f7d8a023c6c759696d84a
parent3ce35fb6fae74164dbbd35bc14e7bf2ab03cadf5 (diff)
downloadlv2-0976ea4ea523e7ba534968e35b9bfeb6b9cb5482.tar.xz
Fix links in online documentation index
-rwxr-xr-xlv2specgen/lv2specgen.py18
-rw-r--r--wscript1
2 files changed, 15 insertions, 4 deletions
diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py
index 8cfa1c7..e3948f1 100755
--- a/lv2specgen/lv2specgen.py
+++ b/lv2specgen/lv2specgen.py
@@ -1246,7 +1246,7 @@ def load_tags(path, docdir):
return linkmap
-def writeIndex(model, specloc, index_path, root_path, root_uri):
+def writeIndex(model, specloc, index_path, root_path, root_uri, online):
# Get extension URI
ext_node = model.value(None, rdf.type, lv2.Specification)
if not ext_node:
@@ -1294,9 +1294,12 @@ def writeIndex(model, specloc, index_path, root_path, root_uri):
# Find relative link target
if root_uri and ext_node.startswith(root_uri):
- target = ext_node[len(root_uri) :] + ".html"
+ target = ext_node[len(root_uri) :]
else:
- target = os.path.relpath(ext_node, root_path) + ".html"
+ target = os.path.relpath(ext_node, root_path)
+
+ if not online:
+ target += ".html"
stem = os.path.splitext(os.path.basename(target))[0]
@@ -1553,7 +1556,7 @@ def specgen(
# Write index row
if index_path is not None:
- writeIndex(m, specloc, index_path, root_path, root_uri)
+ writeIndex(m, specloc, index_path, root_path, root_uri, opts["online"])
# Validate complete output page
try:
@@ -1709,6 +1712,13 @@ if __name__ == "__main__":
dest="copy_style",
help="Copy style from template directory to output directory",
)
+ opt.add_option(
+ "-o",
+ "--online",
+ action="store_true",
+ dest="online",
+ help="Generate index for online documentation",
+ )
(options, args) = opt.parse_args()
opts = vars(options)
diff --git a/wscript b/wscript
index 7c7161f..bdda6cb 100644
--- a/wscript
+++ b/wscript
@@ -373,6 +373,7 @@ def build(bld):
' --docdir=' + os.path.relpath('doc/html', out_dir) +
' --tags=%s' % bld.path.get_bld().make_node('doc/tags') +
' --index=' + str(index_file) +
+ (' --online' if bld.env.ONLINE_DOCS else '') +
' ${SRC} ${TGT}')
bld(rule = cmd,