epydoc.latex.LatexFormatter

Package epydoc :: Module latex :: Class LatexFormatter |
[show private | hide private]
[frames | no frames]

## Class LatexFormatter

Documentation to LaTeX converter. The API documentation produced by `LatexFormatter` consists of a single LaTeX document, divided into several different files. In particular, `LatexFormatter` generates the following files:

- api.tex: The top-level LaTeX file. This file imports the other files, to create a single unified document. This is the file that you should run `latex` on.
- module-module.tex: The API documentation for a module. module is the complete dotted name of the module, such as `sys` or `epydoc.epytext`.
- class-class.tex: The API documentation for a class, exception, or type. class is the complete dotted name of the class, such as `epydoc.epytext.Token` or `array.ArrayType`. These class documentation files are only created if the `list_classes_separately` option is used; otherwise, the documentation for each class is included in its module's documentation file.

The methods `write_module` and `write_class` used to generate individual module and class documentation LaTeX files. These files can then be included as chapters or sections of other LaTeX documents (with `"\include"`). When using these methods, you may wish to disable the `crossref` option, which will turn off crossreferencing betweeen modules and classes, since some of these crossreference links will be broken if you only include some of the API documentation as chapters or sections of your document.

Method Summary
| ``__init__`(self, docmap, **kwargs)` Construct a new LaTeX formatter, using the given documentation map.
`int` | ``num_files`(self)` Return the number of files that this `LatexFormatter` will generate.
`None` | ``write`(self, directory, progress_callback)` Write the API documentation for the entire project to the given directory.
| ``write_class`(self, uid, filename)` Write the API documentation for the given class to `filename`.
| ``write_module`(self, uid, filename)` Write the API documentation for the given module to `filename`.
| `_base_tree(self, uid, width, linespec)`
| `_base_tree_line(self, uid, width, linespec)`
| `_class_list(self, container, classes)`
| `_class_list_line(self, link)`
| `_class_to_latex(self, uid)`
`int` | ``_cmp_name`(self, name1, name2)` Compare uid1 and uid2 by their names, using the following rules:
| `_descrlist(self, items, singular, plural, short)`
| `_docstring_to_latex(self, docstring, indent, breakany)`
| ``_excluded`(self, x)` Return true if the given object should be excluded from the documentation (since it was imported or inherited from a module that we're not documenting).
`list` of `Link` | ``_filter`(self, links)` Filter a list of `Link`s.
| `_find_tree_width(self, uid)`
| `_func_list(self, container, functions, heading, seclevel)`
| `_func_list_box(self, link, cls)`
| `_func_signature(self, fname, fdoc, show_defaults)`
| `_header(self, where)`
| `_indexterm(self, uid, pos)`
| `_inheritance_list(self, links, cls)`
| `_inheritance_list_line(self, links, cls)`
`boolean` | ``_is_private`(self, str)` Return true if `str` is the name of a private Python object.
| `_kind(self, uid)`
`string` | ``_module_list`(self, container, modules)` Return the HTML code for the module hierarchy tree, containing the given modules.
| `_module_to_latex(self, uid)`
`string` | ``_module_tree`(self, sortorder)` Return the HTML code for the module hierarchy tree.
`string` | ``_module_tree_item`(self, uid, depth)` Helper function for `_module_tree` and `_module_list`.
| `_params_to_latex(self, parameters, show_defaults)`
| `_pprint_var_value(self, var, maxwidth)`
| `_property_list(self, container, properties, heading, seclevel)`
| `_property_list_line(self, link, container)`
| `_section(self, title, depth)`
| `_sectionstar(self, title, depth)`
`string` | ``_standard_fields`(self, doc)` Return hTML code containing descriptions of the epytext fields that are common to all `ObjDoc`s (except for `descr`).
| `_start_of(self, section_name)`
| ``_subclasses`(self, subclasses, container)` Return the LaTeX code for the subclasses field.
`string` | ``_summary`(self, doc, container)` Return the LATEX code for the summary description of the object documented by `doc`.
| ``_text_to_latex`(self, str, nbsp, breakany)`
| `_topfile(self)`
| `_uid_to_label(self, uid)`
| `_var_list(self, container, variables, heading, seclevel)`
| `_var_list_line(self, var, container)`

Instance Variable Summary
| `_docmap`: The documentation map, encoding the objects that should be documented.
| `_show_private`: Whether to include show private objects in the documentation.

Class Variable Summary
`_LatexDocstringLinker` | `_docstring_linker` = `<epydoc.latex._LatexDocstringLinker ...`

Method Details

### __init__(self, docmap, **kwargs) (Constructor) Construct a new LaTeX formatter, using the given documentation map. Parameters: `docmap` - The documentation to output. (type=`DocMap`) `kwargs` - Keyword arguments: `prj_name`: The name of the project. Defaults to none. (type=`string`) `private`: Whether to create documentation for private objects. By default, private objects are documented. (type=`boolean`) `crossref`: Whether to create crossreference links between classes and modules. By default, crossreference links are created. (type=`boolean`) `index`: Whether to generate an index. If you generate an index, you will need to run `makeindex` to make the `.idx` file. By default, an index is generated. (type=`boolean`) `list_classes_separately`: Whether to list classes in separate chapters, or to include them as sections of their modules' chapters. By default, they are not listed separately. (type=`boolean`) `exclude`: Whether to exclude inherited objects and imported objects that are not defined by any of the modules that are being documented. By default, these objects are excluded. (type=`boolean`) `alphabetical`: Whether to list modules in alphabetical order or in the order that they were specified in on the command line. By default, modules are listed in alphabetical order. (type=`boolean`)

### num_files(self) Returns: The number of files that this `LatexFormatter` will generate. (type=`int`)

### write(self, directory=None, progress_callback=None) Write the API documentation for the entire project to the given directory. Parameters: `directory` - The directory to which output should be written. If no directory is specified, output will be written to the current directory. If the directory does not exist, it will be created. (type=`string`) `progress_callback` - A callback function that is called before each file is written, with the name of the created file. (type=`function`) Returns: `None` Raises: `OSError` - If `directory` cannot be created, `OSError` - If any file cannot be created or written to.

### write_class(self, uid, filename) Write the API documentation for the given class to `filename`. Parameters: `uid` - The unique identifier of the class to document. (type=`UID`) `filename` - The name of the file to write the documentation to. (type=`string`) Raises: `OSError` - If `directory` cannot be created, `OSError` - If any file cannot be created or written to. `ValueError` - If `uid` is not the identifier for a class.

### write_module(self, uid, filename) Write the API documentation for the given module to `filename`. Parameters: `uid` - The unique identifier of the module to document. (type=`UID`) `filename` - The name of the file to write the documentation to. (type=`string`) Raises: `OSError` - If `directory` cannot be created, `OSError` - If any file cannot be created or written to. `ValueError` - If `uid` is not the identifier for a module.

### _cmp_name(self, name1, name2) Compare uid1 and uid2 by their names, using the following rules: `'__init__'` < anything. public < private. otherwise, sort alphabetically by name (ignoring case) Returns: -1 if `uid1<uid2`; 0 if `uid1==uid2`; and 1 if `uid1>uid2`. (type=`int`)

### _excluded(self, x) Returns: True if the given object should be excluded from the documentation (since it was imported or inherited from a module that we're not documenting).

### _filter(self, links) Filter a list of `Link`s. If `_show_private` is false, then filter out all private objects; otherwise, perform no filtering. Parameters: `links` - The list of `Link`s to be filtered. (type=`list` of `Link`) Returns: The filtered list of links. (type=`list` of `Link`)

### _is_private(self, str) Returns: true if `str` is the name of a private Python object. (type=`boolean`)

### _module_list(self, container, modules) Returns: The HTML code for the module hierarchy tree, containing the given modules. This is used by `_module_to_latex` to list the submodules of a package. (type=`string`)

### _module_tree(self, sortorder=None) Returns: The HTML code for the module hierarchy tree. This is used by `_trees_to_latex` to construct the hiearchy page. (Well, actually, it's not used by anything at present.) (type=`string`)

### _module_tree_item(self, uid=None, depth=0) Helper function for `_module_tree` and `_module_list`. Returns: `string`

### _standard_fields(self, doc) Parameters: `doc` - The object whose fields should be described. Returns: HTML code containing descriptions of the epytext fields that are common to all `ObjDoc`s (except for `descr`). (type=`string`)

### _subclasses(self, subclasses, container) Returns: The LaTeX code for the subclasses field.

### _summary(self, doc, container=None) Parameters: `doc` - The documentation for the object whose summary should be returned. (type=`objdoc.ObjDoc`) `container` - The container object for `doc`, or `None` if there is none. This container object is used to resolve links (L{...}) in the epytext. (type=`uid.UID`) Returns: The LATEX code for the summary description of the object documented by `doc`. A summary description is the first sentence of the `doc`'s 'description' field. If the `doc` has no 'description' field, but does have a 'return' field, then the summary is taken from the return field instead. (type=`string`)

### _text_to_latex(self, str, nbsp=0, breakany=0) Parameters: `breakany` - Insert hyphenation marks, so that LaTeX can break the resulting string at any point. This is useful for small boxes (e.g., the type box in the variable list table).

Instance Variable Details

### _docmap The documentation map, encoding the objects that should be documented.

### _show_private Whether to include show private objects in the documentation.

Class Variable Details

    ### _docstring_linker Type: `_LatexDocstringLinker` Value:
        <epydoc.latex._LatexDocstringLinker instance at 0x826dbf4>

Generated by Epydoc 2.1 on Sat Mar 20 17:46:19 2004 | http://epydoc.sf.net