diff options
author | Ka-Ping Yee <ping@zesty.ca> | 2001-02-27 22:42:36 (GMT) |
---|---|---|
committer | Ka-Ping Yee <ping@zesty.ca> | 2001-02-27 22:42:36 (GMT) |
commit | 6f3f9a4c64dd5474b536fc897bfdc1efc982e04d (patch) | |
tree | ce30a04fe90668bc72411d1fd5b70c188487a3af /Lib/pydoc.py | |
parent | 969ab2710a2ddd5a088aca5d76aa366df579195c (diff) | |
download | cpython-6f3f9a4c64dd5474b536fc897bfdc1efc982e04d.zip cpython-6f3f9a4c64dd5474b536fc897bfdc1efc982e04d.tar.gz cpython-6f3f9a4c64dd5474b536fc897bfdc1efc982e04d.tar.bz2 |
Add display of $Revision $ and credits.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-x | Lib/pydoc.py | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 45e0966..9dc359f 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -20,7 +20,13 @@ In the Python interpreter, do "from pydoc import help" to provide online help. Calling help(thing) on a Python object documents the object.""" __author__ = "Ka-Ping Yee <ping@lfw.org>" -__version__ = "26 February 2001" +__date__ = "26 February 2001" +__version__ = "$Revision $" +__credits__ = """Tommy Burnette, the original creator of manpy. +Paul Prescod, for all his work on onlinehelp. +Richard Chamberlain, for the first implementation of textdoc. + +A moose bit my sister once.""" import sys, imp, os, stat, re, types, inspect from repr import Repr @@ -383,8 +389,16 @@ class HTMLDoc(Doc): filelink = '<a href="file:%s">%s</a>' % (file, file) except TypeError: filelink = '(built-in)' + info = [] if hasattr(object, '__version__'): - head = head + ' (version: %s)' % self.escape(object.__version__) + version = str(object.__version__) + if version[:11] == '$Revision$': + version = version[11:-1] + info.append('version: %s' % self.escape(version)) + if hasattr(object, '__date__'): + info.append(self.escape(str(object.__date__))) + if info: + head = head + ' (%s)' % join(info, ', ') result = result + self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink) @@ -463,6 +477,16 @@ class HTMLDoc(Doc): result = result + self.bigsection( 'Constants', '#ffffff', '#55aa55', contents) + if hasattr(object, '__author__'): + contents = self.markup(str(object.__author__), self.preformat) + result = result + self.bigsection( + 'Author', '#ffffff', '#7799ee', contents) + + if hasattr(object, '__credits__'): + contents = self.markup(str(object.__credits__), self.preformat) + result = result + self.bigsection( + 'Credits', '#ffffff', '#7799ee', contents) + return result def docclass(self, object, funcs={}, classes={}): @@ -694,16 +718,15 @@ class TextDoc(Doc): if hasattr(object, '__version__'): version = str(object.__version__) - if hasattr(object, '__date__'): - version = version + ', ' + str(object.__date__) + if version[:11] == '$Revision$': + version = version[11:-1] result = result + self.section('VERSION', version) - + if hasattr(object, '__date__'): + result = result + self.section('DATE', str(object.__date__)) if hasattr(object, '__author__'): - author = str(object.__author__) - if hasattr(object, '__email__'): - author = author + ' <' + str(object.__email__) + '>' - result = result + self.section('AUTHOR', author) - + result = result + self.section('AUTHOR', str(object.__author__)) + if hasattr(object, '__credits__'): + result = result + self.section('CREDITS', str(object.__credits__)) return result def docclass(self, object): |