1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-15 18:58:55 +01:00

Use a nicer frameless style for the docs, with a navigation bar down the side

This commit is contained in:
David Sansome 2011-02-16 13:53:53 +00:00
parent b106979fb7
commit 5fa98e6a63
2 changed files with 77 additions and 5 deletions

View File

@ -30,7 +30,7 @@ h1 { font-size: 140%;
position: relative;
border-top: 1px solid #36C;
background-color: #E5ECF9; }
h2 { font-size: +125%; font-style: italic;
h2 { font-size: +125%;
font-weight: bold; }
h3 { font-size: +110%; font-style: italic;
font-weight: normal; }
@ -70,6 +70,26 @@ span.options { font-size: 70%; }
span.codelink { font-size: 85%; }
td.footer { font-size: 85%; }
div.sidebar {
float: left;
position: absolute;
left: 0px;
top: 0px;
width: 350px;
margin-left: 6px;
margin-right: 6px;
}
div.maincontent {
float: left;
position: absolute;
left: 362px;
top: 0px;
border-left: 3px solid #E5ECF9;
padding-left: 6px;
padding-top: 3px;
}
/* Table Headers
* - Each summary table and details section begins with a 'header'
* row. This row contains a section title (marked by
@ -222,8 +242,13 @@ pre.base-tree { color: #555555; margin: 0; }
h1.toc { text-align: center; font-size: 105%;
margin: 0; font-weight: bold;
padding: 0; }
h2.toc { font-size: 100%; font-weight: bold;
margin: 0.5em 0 0 -0.3em; }
h2.toc { font-size: 100%;
font-weight: bold;
margin: 3px 0px 3px 0px;
padding: 1px 3px;
position: relative;
border-top: 1px solid #36C;
background-color: #E5ECF9; }
/* Syntax Highlighting for Source Code
* - doctest examples are displayed in a 'pre.py-doctest' block.

View File

@ -1,9 +1,11 @@
import epydoc.apidoc
import epydoc.cli
import epydoc.docintrospecter
import epydoc.docwriter.html
import inspect
import PyQt4.QtCore
import sys
import inspect
import types
# SIP does some strange stuff with the __dict__ of wrapped C++ classes:
# someclass.__dict__["function"] != someclass.function
@ -33,6 +35,50 @@ def introspect_pyqt_wrapper_class(thing, doc, module_name=None):
epydoc.docintrospecter.register_introspecter(is_pyqt_wrapper_class, introspect_pyqt_wrapper_class)
# Monkey-patch some functions in the HTML docwriter to show a table of contents
# down the side of each page, instead of in a separate frame.
original_write_header = epydoc.docwriter.html.HTMLWriter.write_header
def my_write_header(self, out, title):
original_write_header(self, out, title)
out('<div class="sidebar">')
self.write_toc_section(out, "All Classes", self.class_list)
# List the functions.
funcs = [d for d in self.routine_list
if not isinstance(self.docindex.container(d),
(epydoc.apidoc.ClassDoc, types.NoneType))]
self.write_toc_section(out, "All Functions", funcs)
# List the variables.
vars = []
for doc in self.module_list:
vars += doc.select_variables(value_type='other',
imported=False,
public=self._public_filter)
self.write_toc_section(out, "All Variables", vars)
out('</div>')
out('<div class="maincontent">')
def my_write_footer(self, out, short=False):
out('</div></body></html>')
def my_write_navbar(self, out, context):
pass
original_write_toc_section = epydoc.docwriter.html.HTMLWriter.write_toc_section
def my_write_toc_section(self, out, name, docs, fullname=True):
docs = [x for x in docs if not str(x.canonical_name).startswith('PyQt4')]
original_write_toc_section(self, out, name, docs, fullname=fullname)
epydoc.docwriter.html.HTMLWriter.write_header = my_write_header
epydoc.docwriter.html.HTMLWriter.write_footer = my_write_footer
epydoc.docwriter.html.HTMLWriter.write_navbar = my_write_navbar
epydoc.docwriter.html.HTMLWriter.write_toc_section = my_write_toc_section
sys.argv = [
"epydoc",
"--html",
@ -43,6 +89,7 @@ sys.argv = [
"--css", "epydoc.css",
"--no-sourcecode",
"--no-private",
"--no-frames",
"clementine",
]