From 1d75440f9719b9f2de57f6250f574b427939ea50 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 14 Nov 2011 04:26:15 +0000 Subject: Use htaccess for conneg instead of PHP. --- gendoc.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'gendoc.py') diff --git a/gendoc.py b/gendoc.py index 2587e7b..a7d24b3 100755 --- a/gendoc.py +++ b/gendoc.py @@ -77,6 +77,16 @@ for cn in root.childNodes: mafile, manchor)) bettertags.close() +def subst_file(template, output, dict): + i = open(template, 'r') + o = open(output, 'w') + for line in i: + for key in dict: + line = line.replace(key, dict[key]) + o.write(line) + i.close() + o.close() + print('** Generating core documentation') lv2_outdir = os.path.join(out_base, 'lv2core') @@ -84,7 +94,6 @@ os.mkdir(lv2_outdir) shutil.copy('core.lv2/lv2.h', lv2_outdir) shutil.copy('core.lv2/lv2.ttl', lv2_outdir) shutil.copy('core.lv2/manifest.ttl', lv2_outdir) -shutil.copy('doc/index.php', lv2_outdir) oldcwd = os.getcwd() os.chdir(lv2_outdir) @@ -98,6 +107,9 @@ lv2specgen.save('lv2.html', os.path.join('..', '..', '..', TAGFILE), instances=True)) os.chdir(oldcwd) +subst_file('doc/htaccess.in', '%s/lv2core/.htaccess' % out_base, + { '@NAME@': 'lv2core', + '@BASE@': '/ns/lv2core' }) footer = open('./lv2specgen/footer.html', 'r') @@ -216,7 +228,9 @@ for dir in ['ext', 'extensions']: row += '' extensions.append(row) - shutil.copy('doc/index.php', os.path.join(outdir, b + '.lv2', 'index.php')) + subst_file('doc/htaccess.in', '%s/%s.lv2/.htaccess' % (outdir, b), + { '@NAME@': b, + '@BASE@': '/ns/%s/%s' % (dir, b) }) # Remove .lv2 suffix from bundle name (to make URI resolvable) os.rename(outdir + '/%s.lv2' % b, outdir + '/%s' % b) -- cgit v1.2.1