Generate an HTML index for a directory of modules.
(self, dir, shadowed=None)
| 1219 | return lhs + self.repr(object) |
| 1220 | |
| 1221 | def index(self, dir, shadowed=None): |
| 1222 | """Generate an HTML index for a directory of modules.""" |
| 1223 | modpkgs = [] |
| 1224 | if shadowed is None: shadowed = {} |
| 1225 | for importer, name, ispkg in pkgutil.iter_modules([dir]): |
| 1226 | if any((0xD800 <= ord(ch) <= 0xDFFF) for ch in name): |
| 1227 | # ignore a module if its name contains a surrogate character |
| 1228 | continue |
| 1229 | modpkgs.append((name, '', ispkg, name in shadowed)) |
| 1230 | shadowed[name] = 1 |
| 1231 | |
| 1232 | modpkgs.sort() |
| 1233 | contents = self.multicolumn(modpkgs, self.modpkglink) |
| 1234 | return self.bigsection(dir, 'index', contents) |
| 1235 | |
| 1236 | # -------------------------------------------- text documentation generator |
| 1237 |