def format(self,modules=None): self.generalizations=[] ret=HEADER if modules: from epydoc.uid import findUID for m in modules: uid=findUID(m) if uid.is_module(): print >>sys.stderr,"Formatting: %s\n" % (uid,) ret+=self.format_module(uid,True) else: print >>sys.stderr,"Skipping: %s (not a module)\n" % (uid,) else: decorated = [(u.name().lower(), u) for u in self.docmap.keys() if u.is_module()] decorated.sort() uids = [d[-1] for d in decorated] for uid in uids: if uid.is_module(): ret+=self.format_module(uid,False) ret+="\n".join(self.generalizations)+"\n" ret+=FOOTER return ret
def format(self, modules=None): self.generalizations = [] ret = HEADER if modules: from epydoc.uid import findUID for m in modules: uid = findUID(m) if uid.is_module(): print >> sys.stderr, "Formatting: %s\n" % (uid, ) ret += self.format_module(uid, True) else: print >> sys.stderr, "Skipping: %s (not a module)\n" % ( uid, ) else: decorated = [(u.name().lower(), u) for u in self.docmap.keys() if u.is_module()] decorated.sort() uids = [d[-1] for d in decorated] for uid in uids: if uid.is_module(): ret += self.format_module(uid, False) ret += "\n".join(self.generalizations) + "\n" ret += FOOTER return ret
elif uid.is_routine(): return 'function' elif uid.is_variable(): return 'variable' else: raise AssertionError, 'Bad UID type for _name' def _name(self, uid): if uid.parent(): parent = uid.parent() name = '%s %s in %s %s' % (self._kind(uid), self._bold(uid.shortname()), self._kind(parent), self._bold(parent.name())) else: name = '%s %s' % (self._kind(uid), self._bold(uid.name())) return '%s %s\n\n' % (self._title('NAME'), name) def _descr(self, uid, doc): if not doc.descr(): return '' descr = doc.descr().to_plaintext(None, indent=4) return '%s%s' % (self._title('DESCRIPTION'), descr) if __name__ == '__main__': docmap = DocMap(document_bases=1) uids = [findUID(name) for name in sys.argv[1:]] uids = [uid for uid in uids if uid is not None] for uid in uids: docmap.add(uid.value()) formatter = ManFormatter(docmap) for uid in uids: print formatter.documentation(uid)