diff options
| author | Jean Abou Samra <jean@abou-samra.fr> | 2023-03-30 22:21:09 +0200 |
|---|---|---|
| committer | Jean Abou Samra <jean@abou-samra.fr> | 2023-03-30 22:21:09 +0200 |
| commit | 243dd815b90bbc25f038149e9b99b70f0bd1a146 (patch) | |
| tree | cc20ce39dc80845b96f84b7651c6b569f529cb65 /doc | |
| parent | 09c8a31039366b03c3b7e117ee998eaa43f9c7dc (diff) | |
| download | pygments-git-243dd815b90bbc25f038149e9b99b70f0bd1a146.tar.gz | |
Use autodoc for Formatter class
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/docs/api.rst | 49 |
1 files changed, 2 insertions, 47 deletions
diff --git a/doc/docs/api.rst b/doc/docs/api.rst index b38ca8b0..6260fde7 100644 --- a/doc/docs/api.rst +++ b/doc/docs/api.rst @@ -177,53 +177,8 @@ Formatters A formatter is derived from this class: -.. class:: Formatter(**options) - - As with lexers, this constructor processes options and then must call the - base class :meth:`__init__`. - - The :class:`Formatter` class recognizes the options `style`, `full` and - `title`. It is up to the formatter class whether it uses them. - - .. method:: get_style_defs(arg='') - - This method must return statements or declarations suitable to define - the current style for subsequent highlighted text (e.g. CSS classes - in the `HTMLFormatter`). - - The optional argument `arg` can be used to modify the generation and - is formatter dependent (it is standardized because it can be given on - the command line). - - This method is called by the ``-S`` :doc:`command-line option <cmdline>`, - the `arg` is then given by the ``-a`` option. - - .. method:: format(tokensource, outfile) - - This method must format the tokens from the `tokensource` iterable and - write the formatted version to the file object `outfile`. - - Formatter options can control how exactly the tokens are converted. - - .. versionadded:: 0.7 - A formatter must have the following attributes that are used by the - builtin lookup mechanism. - - .. attribute:: name - - Full name for the formatter, in human-readable form. - - .. attribute:: aliases - - A list of short, unique identifiers that can be used to lookup - the formatter from a list, e.g. using :func:`.get_formatter_by_name()`. - - .. attribute:: filenames - - A list of :mod:`fnmatch` patterns that match filenames for which this - formatter can produce output. The patterns in this list should be unique - among all formatters. - +.. autoclass:: Formatter + :members: __init__, get_style_defs, format .. module:: pygments.util |
