def find_specials(doctree): while doctree.parent() and doctree.tag() != "Module": doctree = doctree.parent() author = doctree.child(name='__author__') version = doctree.child(name='__version__') if author: author = author.child(tag='Value').text()[1:-1] # Check for email address from pythondoc.docregex import email_regex match = email_regex.search(author) if match: email = match.group(0) author = author[:match.start()] + \ author[match.start() + len(email):] author = string.strip(author) while author[-1] in ',.:;-': author = author[:-1] author = 'Author: <A HREF="mailto:%s">%s</A>' % ( email, pythondoc.doctree.escape(author)) if version: version = "Version: %s" % pythondoc.doctree.escape( version.child(tag='Value').text()[1:-1]) return author or '', version or ''
def find_specials(doctree): while doctree.parent() and doctree.tag() != "Module": doctree = doctree.parent() author = doctree.child(name='__author__') version = doctree.child(name='__version__') if author: author = author.child(tag='Value').text()[1:-1] # Check for email address from pythondoc.docregex import email_regex match = email_regex.search(author) if match: email = match.group(0) author = author[:match.start()] + \ author[match.start() + len(email):] author = string.strip(author) while author[-1] in ',.:;-': author = author[:-1] author = 'Author: <A HREF="mailto:%s">%s</A>' % (email, pythondoc.doctree.escape(author)) if version: version = "Version: %s" % pythondoc.doctree.escape(version.child(tag='Value').text()[1:-1]) return author or '', version or ''
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)