mirror of
https://github.com/python/cpython.git
synced 2025-10-15 11:22:18 +00:00
+ Got rid of all instances of <small>. Under IE5, GUI-mode pydoc has
always been close to useless, because the <small>-ified docstrings were too small to read, even after cranking up my default font size just for pydoc. Now it reads fine under my defaults (as does most of the web <0.5 wink>). If it's thought important to play tricks with font size, tough, then someone should rework pydoc to use style sheets, and (more) predictable percentage-of-default size controls. + Tried to ensure that all <dt> and <dd> tags are closed. I've read (but don't know) that some browsers get confused if they're not, and esp. when style sheets are in use too.
This commit is contained in:
parent
3e767d19e0
commit
2306d246e8
1 changed files with 19 additions and 22 deletions
41
Lib/pydoc.py
41
Lib/pydoc.py
|
@ -348,8 +348,8 @@ TT { font-family: lucidatypewriter, lucida console, courier }
|
||||||
return '''
|
return '''
|
||||||
<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> <br>
|
||||||
><font color="%s" face="helvetica, arial"> <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, arial">%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 ' ')
|
||||||
|
@ -362,8 +362,8 @@ TT { font-family: lucidatypewriter, lucida console, courier }
|
||||||
result = '''
|
result = '''
|
||||||
<p><table width="100%%" cellspacing=0 cellpadding=2 border=0>
|
<p><table width="100%%" cellspacing=0 cellpadding=2 border=0>
|
||||||
<tr bgcolor="%s">
|
<tr bgcolor="%s">
|
||||||
<td colspan=3 valign=bottom><small><small> <br></small></small
|
<td colspan=3 valign=bottom> <br>
|
||||||
><font color="%s" face="helvetica, arial">%s</font></td></tr>
|
<font color="%s" face="helvetica, arial">%s</font></td></tr>
|
||||||
''' % (bgcol, fgcol, title)
|
''' % (bgcol, fgcol, title)
|
||||||
if prelude:
|
if prelude:
|
||||||
result = result + '''
|
result = result + '''
|
||||||
|
@ -399,7 +399,6 @@ TT { font-family: lucidatypewriter, lucida console, courier }
|
||||||
result = result + '</td>'
|
result = result + '</td>'
|
||||||
return '<table width="100%%"><tr>%s</tr></table>' % result
|
return '<table width="100%%"><tr>%s</tr></table>' % result
|
||||||
|
|
||||||
def small(self, text): return '<small>%s</small>' % text
|
|
||||||
def grey(self, text): return '<font color="#909090">%s</font>' % text
|
def grey(self, text): return '<font color="#909090">%s</font>' % text
|
||||||
|
|
||||||
def namelink(self, name, *dicts):
|
def namelink(self, name, *dicts):
|
||||||
|
@ -478,14 +477,14 @@ TT { font-family: lucidatypewriter, lucida console, courier }
|
||||||
for entry in tree:
|
for entry in tree:
|
||||||
if type(entry) is type(()):
|
if type(entry) is type(()):
|
||||||
c, bases = entry
|
c, bases = entry
|
||||||
result = result + '<dt><font face="helvetica, arial"><small>'
|
result = result + '<dt><font face="helvetica, arial">'
|
||||||
result = result + self.classlink(c, modname)
|
result = result + self.classlink(c, modname)
|
||||||
if bases and bases != (parent,):
|
if bases and bases != (parent,):
|
||||||
parents = []
|
parents = []
|
||||||
for base in bases:
|
for base in bases:
|
||||||
parents.append(self.classlink(base, modname))
|
parents.append(self.classlink(base, modname))
|
||||||
result = result + '(' + join(parents, ', ') + ')'
|
result = result + '(' + join(parents, ', ') + ')'
|
||||||
result = result + '\n</small></font></dt>'
|
result = result + '\n</font></dt>'
|
||||||
elif type(entry) is type([]):
|
elif type(entry) is type([]):
|
||||||
result = result + '<dd>\n%s</dd>\n' % self.formattree(
|
result = result + '<dd>\n%s</dd>\n' % self.formattree(
|
||||||
entry, modname, c)
|
entry, modname, c)
|
||||||
|
@ -552,7 +551,7 @@ TT { font-family: lucidatypewriter, lucida console, courier }
|
||||||
|
|
||||||
doc = self.markup(getdoc(object), self.preformat, fdict, cdict)
|
doc = self.markup(getdoc(object), self.preformat, fdict, cdict)
|
||||||
doc = doc and '<tt>%s</tt>' % doc
|
doc = doc and '<tt>%s</tt>' % doc
|
||||||
result = result + '<p>%s</p>\n' % self.small(doc)
|
result = result + '<p>%s</p>\n' % doc
|
||||||
|
|
||||||
if hasattr(object, '__path__'):
|
if hasattr(object, '__path__'):
|
||||||
modpkgs = []
|
modpkgs = []
|
||||||
|
@ -646,7 +645,7 @@ TT { font-family: lucidatypewriter, lucida console, courier }
|
||||||
if value.__doc__ is not None:
|
if value.__doc__ is not None:
|
||||||
doc = self.markup(value.__doc__, self.preformat,
|
doc = self.markup(value.__doc__, self.preformat,
|
||||||
funcs, classes, mdict)
|
funcs, classes, mdict)
|
||||||
push('<dd><small><tt>%s</tt></small></dd>\n' % doc)
|
push('<dd><tt>%s</tt></dd>\n' % doc)
|
||||||
for attr, tag in [("fset", " setter"),
|
for attr, tag in [("fset", " setter"),
|
||||||
("fget", " getter"),
|
("fget", " getter"),
|
||||||
("fdel", " deleter")]:
|
("fdel", " deleter")]:
|
||||||
|
@ -671,7 +670,7 @@ TT { font-family: lucidatypewriter, lucida console, courier }
|
||||||
else:
|
else:
|
||||||
doc = self.markup(getdoc(value), self.preformat,
|
doc = self.markup(getdoc(value), self.preformat,
|
||||||
funcs, classes, mdict)
|
funcs, classes, mdict)
|
||||||
doc = '<dd>' + self.small('<tt>%s</tt>' % doc)
|
doc = '<dd><tt>%s</tt>' % doc
|
||||||
push('<dl><dt>%s%s</dl>\n' % (base, doc))
|
push('<dl><dt>%s%s</dl>\n' % (base, doc))
|
||||||
push('\n')
|
push('\n')
|
||||||
return attrs
|
return attrs
|
||||||
|
@ -737,15 +736,13 @@ TT { font-family: lucidatypewriter, lucida console, courier }
|
||||||
for base in bases:
|
for base in bases:
|
||||||
parents.append(self.classlink(base, object.__module__))
|
parents.append(self.classlink(base, object.__module__))
|
||||||
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 = doc and '<tt>%s<br> </tt>' % doc or ' '
|
||||||
doc = self.small(doc and '<tt>%s<br> </tt>' % doc or
|
|
||||||
self.small(' '))
|
|
||||||
return self.section(title, '#000000', '#ffc8d8', contents, 5, doc)
|
return self.section(title, '#000000', '#ffc8d8', contents, 5, doc)
|
||||||
|
|
||||||
def formatvalue(self, object):
|
def formatvalue(self, object):
|
||||||
"""Format an argument default value as text."""
|
"""Format an argument default value as text."""
|
||||||
return self.small(self.grey('=' + self.repr(object)))
|
return self.grey('=' + self.repr(object))
|
||||||
|
|
||||||
def docroutine(self, object, name=None, mod=None,
|
def docroutine(self, object, name=None, mod=None,
|
||||||
funcs={}, classes={}, methods={}, cl=None):
|
funcs={}, classes={}, methods={}, cl=None):
|
||||||
|
@ -791,16 +788,16 @@ TT { font-family: lucidatypewriter, lucida console, courier }
|
||||||
else:
|
else:
|
||||||
argspec = '(...)'
|
argspec = '(...)'
|
||||||
|
|
||||||
decl = title + argspec + (note and self.small(self.grey(
|
decl = title + argspec + (note and self.grey(
|
||||||
'<font face="helvetica, arial">%s</font>' % note)))
|
'<font face="helvetica, arial">%s</font>' % note))
|
||||||
|
|
||||||
if skipdocs:
|
if skipdocs:
|
||||||
return '<dl><dt>%s</dl>\n' % decl
|
return '<dl><dt>%s</dt></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 '<dd>' + self.small('<tt>%s</tt>' % doc)
|
doc = doc and '<dd><tt>%s</tt></dd>' % doc
|
||||||
return '<dl><dt>%s%s</dl>\n' % (decl, doc)
|
return '<dl><dt>%s</dt>%s</dl>\n' % (decl, doc)
|
||||||
|
|
||||||
def docother(self, object, name=None, mod=None):
|
def docother(self, object, name=None, mod=None):
|
||||||
"""Produce HTML documentation for a data object."""
|
"""Produce HTML documentation for a data object."""
|
||||||
|
@ -1801,8 +1798,8 @@ def serve(port, callback=None, completer=None):
|
||||||
for dir in pathdirs():
|
for dir in pathdirs():
|
||||||
indices.append(html.index(dir, seen))
|
indices.append(html.index(dir, seen))
|
||||||
contents = heading + join(indices) + '''<p align=right>
|
contents = heading + join(indices) + '''<p align=right>
|
||||||
<small><small><font color="#909090" face="helvetica, arial"><strong>
|
<font color="#909090" face="helvetica, arial"><strong>
|
||||||
pydoc</strong> by Ka-Ping Yee <ping@lfw.org></font></small></small>'''
|
pydoc</strong> by Ka-Ping Yee <ping@lfw.org></font>'''
|
||||||
self.send_document('Index of Modules', contents)
|
self.send_document('Index of Modules', contents)
|
||||||
|
|
||||||
def log_message(self, *args): pass
|
def log_message(self, *args): pass
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue