import xml.sax.saxutils def mkDocTable(objects): objects.sort(lambda o1, o2: cmp(o1.__doc__, o2.__doc__)) for object in objects: if object.__doc__ is None: print '
%s
Bad object
' % \ xml.sax.saxutils.escape(str(object)) continue text = object.__doc__ lines = text.split('\n') head = lines[0].strip() head = xml.sax.saxutils.escape(head) body = [] for line in lines[1:]: line = line.strip() #xml.sax.saxutils.escape( line.strip() ) line = line.replace('.', '.
') body.append(line) body = '\n'.join(body) print '
%s
%s
' % (head, body) #print '%sIntentionally blank%s' % (head, body)