def _index(self, doctree): tag = string.lower(doctree.tag()) attr = "index_" + tag if hasattr(self, attr): exec "self.%s(doctree)" % attr for child in doctree.children(): self._index(child)
def _index(self, doctree): tag = string.lower(doctree.tag()) if tag == 'module': path = doctree.attribute('id') if path not in map(lambda (a, b): a, self.__entries): # Find oneliner esc = pythondoc.doctree.escape oneliner = doctree.child(tag="Oneliner") if oneliner: oneliner = ' - ' + esc(oneliner.text()) else: oneliner = '' self.__entries.append((path, oneliner)) for child in doctree.children(tag="Module"): self._index(child)