Index: Lib/pydoc_data/_pydoc.css =================================================================== --- Lib/pydoc_data/_pydoc.css (revision 87586) +++ Lib/pydoc_data/_pydoc.css (working copy) @@ -2,5 +2,221 @@ CSS file for pydoc. Contents of this file are subject to change without notice. +*/ -*/ + +/* Setting underline on hover only is less busy. */ +a:link{ + text-decoration: none; + } +a:visited{ + text-decoration: none; + } +a:hover, a:active{ + text-decoration: underline; + } + +body{ + font-size:100%; /* helps scaling consistency */ + background-color: #f8f8f8; + } + +/* Contains header, navbar, and content and sets page padding. */ +#page { + padding: .5em; + overflow: auto; + } + +/* Contains title, version, and navigation bar. */ +#header{ + width: 100%; + overflow: auto; + } + +/* Title */ +#page_title{ + display: inline-block; + margin: 0; + padding: 0 2em 0 0; + color: #59c; + background-color: inherit; + } + +/* Version info */ +#python_version{ + display: inline-block; + margin: 0; + padding: 0; + font-style: italic; + color: gray; + } + +/* Navigation bar. */ +#navbar{ + padding: 0; + margin: .2em; + min-width: 16em; + background-color: #f0f0f4; + border: 1px solid #888; + overflow: auto; + } +#navbar li{ + margin: 0em; + padding: .25em .5em .25em .5em; + list-style: none; + display: inline-block; + } +#navbar form{ + margin: 0em; + padding: 0em; + display: inline-block; + } + +/* Contains main content. */ +#content{ + overflow: auto; + } + +/* Content title. */ +#subject{ + padding: .25em; + color: white; + background-color: #59c; + } + + +/* A content section that has a title. */ +dl.section{ + color: white; + background-color: blue; + } +dl.section > dt{ + font-weight: bold; + padding: .75em; + } +dl.section > dd{ + padding: 1em; + color: black; + background-color: #f8f8f8; + } + + +/* A section with no left vertical bar. */ +dl.subsection{ + color: white; + background-color: blue; + } +dl.subsection > dt{ + font-weight: bold; + padding: .25em .25em .25em .5em; + } +dl.subsection > dd{ + margin-left: 0; + padding: 1ex; + color: black; + background-color: #f8f8f8; + } + + +/* Set colors for different sections. */ +dl.modules{background-color: #a5c;} + +dl.module{} + +dl.classes{} + +dl.class{} + +dl.methods{} + +dl.method{} + +dl.functions{} + +dl.function{} + +dl.data{} + +ul.data-item li{} + +dl.file{background-color: #090;} + +dl.topics{background-color: #59c;} + +dl.topic{background-color: #090;} + +dl.error{background-color: #c44;} + + +/* index */ +ul.index-lines{ + padding-left: 9ex; + } +ul.index-lines > li{ + text-indent: -8ex; + list-style: none; + } + + +/* index aligned in columns */ +ul.index-columns{ + overflow: auto; + list-style: none; + padding: 0; + margin: 0; + } +ul.index-columns > li{ + margin: 0 1em .2em 0; + float: left; + width: 15em; + } + + +/* links to modules and packages */ +span.module {} + +span.package { + font-style: italic; + color: #555; + } +span.package > a{ + font-style: normal; + font-weight: bold; + font-size: 98%; /* bold effects floats without this. */ + } + + +pre.docstring{ + background-color: #fafaff; + margin: 0; + padding: .25em; + border: 1px solid #aaa; + overflow: auto; + } + + +pre.topic-info{ + background-color: #ffffff; + margin: 0; + padding: .25em; + border: 1px solid #aaa; + overflow: auto; + } + + +pre.python-code{ + background-color: #ffffff; + margin: 0; + padding: .25em; + border: 1px solid #aaa; + overflow: auto; + } +pre.python-code > code{ + background-color: #f4f4ff; /* show white space */ + } + + +#footer > p{ + color: #99a; + text-align: right; + } Index: Lib/pydoc.py =================================================================== --- Lib/pydoc.py (revision 87586) +++ Lib/pydoc.py (working copy) @@ -2471,234 +2471,295 @@ def page(self, title, contents): """Format an HTML page.""" - css_path = "pydoc_data/_pydoc.css" - css_link = ( - '' % - css_path) - return '''\ - -
' + html.bigsection( - 'Built-in Modules', '#ffffff', '#ee77aa', contents)] + def html_header(): + values = dict( + version=platform.python_version(), + build=platform.python_build()[0], + compiler=platform.python_compiler(), + platform=platform.platform(terse=True), + ) + template = \ +""" +
+ Python {version} - [{build}, {compiler}, {platform}] +
+pydoc by Ka-Ping Yee' - '<ping@lfw.org>') - return 'Index of Modules', ''.join(contents) - def html_search(key): """Search results page.""" # scan for modules search_result = [] - def callback(path, modname, desc): if modname[-9:] == '.__init__': modname = modname[:-9] + ' (package)' - search_result.append((modname, desc and '- ' + desc)) - + search_result.append((modname, desc and ' - ' + desc)) with warnings.catch_warnings(): warnings.filterwarnings('ignore') # ignore problems during import ModuleScanner().run(callback, key) + link_list = ['%s%s' % (name, name, desc) + for name, desc in search_result] + content = html.index_lines('key = %s' % key, link_list, + css_class='section modules') + template = ( '
%s' % lines - heading = html.heading( - 'File Listing', - '#ffffff', '#7799ee') - contents = heading + html.bigsection( - 'File: %s' % path, '#ffffff', '#ee77aa', body) - return 'getfile %s' % path, contents + title = 'getfile %s' % path.replace('%20', ' ') + template = ( '
{lines}
'
+ ' %s' % contents - contents = html.bigsection(topic , '#ffffff','#ee77aa', contents) - xrefs = sorted(xrefs.split()) + title = 'Topic' + text = html.markup(contents) + link_list = ['%s' % (name, name) + for name in sorted(xrefs.split())] + xrefs = html.index_columns('Related help Topics', link_list, + css_class="section topics") + values = dict( + title=title, + topic=topic, + text=text, + xrefs=xrefs, + ) + template = ( '
{text}' + '
{exc}' + '
{err}' + '