Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > media > contrib-backports > by-pkgid > fdcb562c48bbc70273d9b80c58e137e3 > files > 51

stratagus-2.2.6-1mdv2010.2.x86_64.rpm

#!/usr/bin/env python
"Update the command index in index.html."

import os

commands = []
reffiles = {}

for infile in os.listdir('.'):
    if not infile.endswith('.html'): continue
    for part in open(infile).read().split('<a name="')[1:]:
        command = part.split('"')[0]
        commands.append(command)
        reffiles[command] = infile

commands.sort()

head, trash, tail = open('index.html').read().split('SCRIPT')

f = open('index.html', 'w')
f.write(head + 'SCRIPT -->\n')
for command in commands:
    f.write('<dt><a href="' + reffiles[command] + '#' + command + '">' + command + '</a></dt>\n')
    f.write('<dd></dd>\n')
f.write('<!-- SCRIPT' + tail)