#!/usr/bin/env python # Horribly hacked-together script to generate an HTML index page for # Haddock-generated Haskell package docs. Note that the docs # directory is hard-coded, below: see the comments there. import os import re import StringIO # This is the path to the docs. Any subdirectory which contains an # 'html/index.html' will get an entry in the index (all the other are # listed separately at the end). # The index is written to 'index.html' at this path. PATH = "/usr/local/share/doc" class Package: def __init__(self, name, path): self.name = name self.path = path self.title = self._seekTitle() def __cmp__(self, other): return cmp(self.name.lower(), other.name.lower()) def index(self): return os.path.join(self.path, 'html', 'index.html') titleRE = r'>.*: (.*)\n') s.write('
\n') s.write('\n') links = ['%s' % (start, start) for start in keys] s.write(' • '.join(links)) s.write('
\n') for start in keys: packages = split[start] s.write('