Produce HTML documentation for a function or method object.
(self, object, name, mod=None,
funcs={}, classes={}, methods={}, cl=None)
| 746 | return ''.join(results) |
| 747 | |
| 748 | def docroutine(self, object, name, mod=None, |
| 749 | funcs={}, classes={}, methods={}, cl=None): |
| 750 | """Produce HTML documentation for a function or method object.""" |
| 751 | |
| 752 | anchor = (cl and cl.__name__ or '') + '-' + name |
| 753 | note = '' |
| 754 | |
| 755 | title = '<a name="%s"><strong>%s</strong></a>' % ( |
| 756 | self.escape(anchor), self.escape(name)) |
| 757 | |
| 758 | if callable(object): |
| 759 | argspec = str(signature(object)) |
| 760 | else: |
| 761 | argspec = '(...)' |
| 762 | |
| 763 | if isinstance(object, tuple): |
| 764 | argspec = object[0] or argspec |
| 765 | docstring = object[1] or "" |
| 766 | else: |
| 767 | docstring = pydoc.getdoc(object) |
| 768 | |
| 769 | decl = title + argspec + (note and self.grey( |
| 770 | '<font face="helvetica, arial">%s</font>' % note)) |
| 771 | |
| 772 | doc = self.markup( |
| 773 | docstring, self.preformat, funcs, classes, methods) |
| 774 | doc = doc and '<dd><tt>%s</tt></dd>' % doc |
| 775 | return '<dl><dt>%s</dt>%s</dl>\n' % (decl, doc) |
| 776 | |
| 777 | def docserver(self, server_name, package_documentation, methods): |
| 778 | """Produce HTML documentation for an XML-RPC server.""" |