| 1 |
#!/usr/bin/env python |
| 2 |
"Update the command index in index.html." |
| 3 |
|
| 4 |
import os |
| 5 |
|
| 6 |
commands = [] |
| 7 |
reffiles = {} |
| 8 |
|
| 9 |
for infile in os.listdir('.'): |
| 10 |
if not infile.endswith('.html'): continue |
| 11 |
for part in open(infile).read().split('<a name="')[1:]: |
| 12 |
command = part.split('"')[0] |
| 13 |
commands.append(command) |
| 14 |
reffiles[command] = infile |
| 15 |
|
| 16 |
commands.sort() |
| 17 |
|
| 18 |
head, trash, tail = open('index.html').read().split('SCRIPT') |
| 19 |
|
| 20 |
f = open('index.html', 'w') |
| 21 |
f.write(head + 'SCRIPT -->\n') |
| 22 |
for command in commands: |
| 23 |
f.write('<dt><a href="' + reffiles[command] + '#' + command + '">' + command + '</a></dt>\n') |
| 24 |
f.write('<dd></dd>\n') |
| 25 |
f.write('<!-- SCRIPT' + tail) |