Home | Trees | Indices | Help |
|
---|
|
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 PythonSourceColorizer
has several
notable features:
'#<name>'
), then that class or function
will automatically be highlighted; and all other classes and function
definition blocks will be 'collapsed'. These collapsed blocks can be
expanded by clicking on them.
'coding:'
declarations).
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
CSS_CLASSES =
A look-up table that is used to determine which CSS class should be used to colorize a given token. |
|||
START_DEF_BLOCK =
HTML code for the beginning of a collapsable function or class definition block. |
|||
END_DEF_BLOCK =
HTML code for the end of a collapsable function or class definition block. |
|||
UNICODE_CODING_RE = re.compile(r'. 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 = False 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
|
|||
_FIX_DECORATOR_RE = re.compile(r' A regexp used to move the <div> that marks the beginning of a function or method to just before the decorators. |
|
|||
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.
|
|||
tab_width The number of spaces to replace each tab in source code with |
|
Create a new HTML colorizer for the specified module.
|
A callback function used by |
Render a single logical line from the module, and write the generated
HTML to
|
|
CSS_CLASSESA look-up table that is used to determine which CSS class should be used to colorize a given token. The following keys may be used:
If no CSS class can be found for a given token, then it won't be marked with any CSS class.
|
START_DEF_BLOCKHTML code for the beginning of a collapsable function or class definition block. The block contains two <div>...</div> elements -- a collapsed version and an expanded version -- and only one of these elements is visible at any given time. By default, all definition blocks are expanded. This string should be interpolated with the following values: (name, indentation, name) Where
|
UNICODE_CODING_REA regular expression used to pick out the unicode encoding for the source file.
|
_FIX_DECORATOR_REA regexp used to move the <div> that marks the beginning of a function or method to just before the decorators.
|
|
line_offsetsA list that maps line numbers to character offsets in
|
cur_lineA list of |
contextA list of the names of the class or functions that include the current
block. |
context_typesA list, corresponding one-to-one with self.context, indicating the type of each entry. Each
element of |
indentsA list of indentation strings for each of the current block's indents.
I.e., the current total indentation can be found by taking
|
def_typeThe type of the class or function whose definition started on the
previous logical line, or |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Jun 13 23:51:50 2008 | http://epydoc.sourceforge.net |