mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Small formatting improvements.
This commit is contained in:
parent
3bda87991a
commit
987ec903d6
1 changed files with 13 additions and 10 deletions
23
Lib/pydoc.py
23
Lib/pydoc.py
|
@ -269,9 +269,9 @@ class HTMLDoc(Doc):
|
||||||
<table width="100%%" cellspacing=0 cellpadding=2 border=0>
|
<table width="100%%" cellspacing=0 cellpadding=2 border=0>
|
||||||
<tr bgcolor="%s">
|
<tr bgcolor="%s">
|
||||||
<td valign=bottom><small> <br></small
|
<td valign=bottom><small> <br></small
|
||||||
><font color="%s" face="helvetica"> <br>%s</font></td
|
><font color="%s" face="helvetica, arial"> <br>%s</font></td
|
||||||
><td align=right valign=bottom
|
><td align=right valign=bottom
|
||||||
><font color="%s" face="helvetica">%s</font></td></tr></table>
|
><font color="%s" face="helvetica, arial">%s</font></td></tr></table>
|
||||||
''' % (bgcol, fgcol, title, fgcol, extras or ' ')
|
''' % (bgcol, fgcol, title, fgcol, extras or ' ')
|
||||||
|
|
||||||
def section(self, title, fgcol, bgcol, contents, width=20,
|
def section(self, title, fgcol, bgcol, contents, width=20,
|
||||||
|
@ -287,9 +287,11 @@ class HTMLDoc(Doc):
|
||||||
''' % (bgcol, fgcol, title)
|
''' % (bgcol, fgcol, title)
|
||||||
if prelude:
|
if prelude:
|
||||||
result = result + '''
|
result = result + '''
|
||||||
<tr bgcolor="%s"><td>%s</td>
|
<tr bgcolor="%s"><td rowspan=2>%s</td>
|
||||||
<td colspan=2>%s</td></tr>''' % (bgcol, marginalia, prelude)
|
<td colspan=2>%s</td></tr>
|
||||||
result = result + '''
|
<tr><td>%s</td>''' % (bgcol, marginalia, prelude, gap)
|
||||||
|
else:
|
||||||
|
result = result + '''
|
||||||
<tr><td bgcolor="%s">%s</td><td>%s</td>''' % (bgcol, marginalia, gap)
|
<tr><td bgcolor="%s">%s</td><td>%s</td>''' % (bgcol, marginalia, gap)
|
||||||
|
|
||||||
return result + '<td width="100%%">%s</td></tr></table>' % contents
|
return result + '<td width="100%%">%s</td></tr></table>' % contents
|
||||||
|
@ -556,7 +558,7 @@ class HTMLDoc(Doc):
|
||||||
title = title + '(%s)' % join(parents, ', ')
|
title = title + '(%s)' % join(parents, ', ')
|
||||||
doc = self.markup(
|
doc = self.markup(
|
||||||
getdoc(object), self.preformat, funcs, classes, mdict)
|
getdoc(object), self.preformat, funcs, classes, mdict)
|
||||||
doc = self.small('<tt>%s<br> </tt>' % doc)
|
doc = self.small(doc and '<tt>%s<br> </tt>' % doc or '<tt> </tt>')
|
||||||
return self.section(title, '#000000', '#ffc8d8', contents, 10, doc)
|
return self.section(title, '#000000', '#ffc8d8', contents, 10, doc)
|
||||||
|
|
||||||
def formatvalue(self, object):
|
def formatvalue(self, object):
|
||||||
|
@ -584,7 +586,7 @@ class HTMLDoc(Doc):
|
||||||
skipdocs = 1
|
skipdocs = 1
|
||||||
else:
|
else:
|
||||||
note = (object.im_self and
|
note = (object.im_self and
|
||||||
'method of ' + self.repr(object.im_self) or
|
' method of ' + self.repr(object.im_self) or
|
||||||
' unbound %s method' % object.im_class.__name__)
|
' unbound %s method' % object.im_class.__name__)
|
||||||
object = object.im_func
|
object = object.im_func
|
||||||
|
|
||||||
|
@ -610,15 +612,16 @@ class HTMLDoc(Doc):
|
||||||
decl = '<em>lambda</em>'
|
decl = '<em>lambda</em>'
|
||||||
argspec = argspec[1:-1] # remove parentheses
|
argspec = argspec[1:-1] # remove parentheses
|
||||||
|
|
||||||
decl = title + argspec + (note and self.small(self.grey(note)))
|
decl = title + argspec + (note and self.small(self.grey(
|
||||||
|
'<font face="helvetica, arial">%s</font>' % note)))
|
||||||
|
|
||||||
if skipdocs:
|
if skipdocs:
|
||||||
return '<dl><dt>%s</dl>' % decl
|
return '<dl><dt>%s</dl>\n' % decl
|
||||||
else:
|
else:
|
||||||
doc = self.markup(
|
doc = self.markup(
|
||||||
getdoc(object), self.preformat, funcs, classes, methods)
|
getdoc(object), self.preformat, funcs, classes, methods)
|
||||||
doc = doc and '<tt>%s</tt>' % doc
|
doc = doc and '<tt>%s</tt>' % doc
|
||||||
return '<dl><dt>%s<dd>%s</dl>' % (decl, self.small(doc))
|
return '<dl><dt>%s<dd>%s</dl>\n' % (decl, self.small(doc))
|
||||||
|
|
||||||
def docother(self, object, name=None):
|
def docother(self, object, name=None):
|
||||||
"""Produce HTML documentation for a data object."""
|
"""Produce HTML documentation for a data object."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue