A class that renders a python module's source code into HTML pages.
These HTML pages are intended to be provided along with the API
documentation for a module, in case a user wants to learn more about a
particular object by examining its source code. Links are therefore
generated from the API documentation to the source code pages, and from
the source code pages back into the API documentation.
The HTML generated by
|
__init__(self,
module_filename,
module_name,
docindex=True,
url_func=True,
name_to_docs=True)
Create a new HTML colorizer for the specified module. |
source code
call graph
|
|
Call Graph |
|
|
|
Call Graph |
|
|
|
Call Graph |
|
|
colorize(self)
Return an HTML string that renders the source code for the module
that was specified in the constructor. |
source code
call graph
|
|
Call Graph |
|
|
tokeneater(self,
toktype,
toktext,
(srow, scol),
(erow, ecol),
line)
A callback function used by tokenize.tokenize to
handle each token in the module. |
source code
call graph
|
|
Call Graph |
|
|
|
Call Graph |
|
|
|
Call Graph |
|
|
|
Call Graph |
|
|
|
Call Graph |
|
|
|
Call Graph |
|
|
|
Call Graph |
|
|
|
Call Graph |
|
|
|
Call Graph |
|
|
|
Call Graph |
|
|
CSS_CLASSES = { ' @ ' : ' py-decorator ' , ' BASECLASS ' : ' py-base-clas ...
A look-up table that is used to determine which CSS class should
be used to colorize a given token.
|
|
START_DEF_BLOCK = ' <div id="%s-collapsed" style="display:none; ...
HTML code for the beginning of a collapsable function or class
definition block.
|
|
END_DEF_BLOCK = ' </div> '
HTML code for the end of a collapsable function or class
definition block.
|
|
UNICODE_CODING_RE = re.compile(r'.*? \n? .*? coding[ :=] \s* ( [ -\w\....
A regular expression used to pick out the unicode encoding for the
source file.
|
|
ADD_DEF_BLOCKS = True
A configuration constant, used to determine whether or not to add
collapsable <div> elements for definition blocks.
|
|
ADD_LINE_NUMBERS = True
A configuration constant, used to determine whether or not to add
line numbers.
|
|
ADD_TOOLTIPS = True
A configuration constant, used to determine whether or not to add
tooltips for linked names.
|
|
GUESS_LINK_TARGETS = True
If true, then try to guess which target is appropriate for linked
names; if false, then always open a div asking the user which one
they want.
|
|
_next_uid = 0
|
|
module_filename
The filename of the module we're colorizing.
|
|
module_name
The dotted name of the module we're colorizing.
|
|
docindex
A docindex, used to create href links from identifiers to the API
documentation for their values.
|
|
name_to_docs
A mapping from short names to lists of ValueDoc, used to decide
which values an identifier might map to when creating href links from
identifiers to the API docs for their values.
|
|
url_func
A function that maps APIDoc -> URL, used to create href links
from identifiers to the API documentation for their values.
|
|
pos
The index in text of the last character of the last
token we've processed.
|
|
line_offsets
A list that maps line numbers to character offsets in
text .
|
|
cur_line
A list of (toktype, toktext) for all tokens on the
logical line that we are currently processing.
|
|
context
A list of the names of the class or functions that include the
current block.
|
|
context_types
A list, corresponding one-to-one with self.context, indicating the type of each entry.
|
|
indents
A list of indentation strings for each of the current block's
indents.
|
|
lineno
The line number of the line we're currently processing.
|
|
def_name
The name of the class or function whose definition started on the
previous logical line, or None if the previous logical
line was not a class or function definition.
|
|
def_type
The type of the class or function whose definition started on the
previous logical line, or None if the previous logical
line was not a class or function definition.
|