diff options
| author | Matthäus G. Chajdas <Anteru@users.noreply.github.com> | 2023-02-13 13:38:43 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-13 13:38:43 +0100 |
| commit | beed6143ec0587e7c6a481ffcf797f07219964f1 (patch) | |
| tree | 908cc183eee268c63ed6f2677aab4f367231275f | |
| parent | 1bc3d96e79e741966742fb7fbe34dfa2c8b93aca (diff) | |
| parent | 5610265217e6d3cd89079a949de5e9ffaba36763 (diff) | |
| download | pygments-git-beed6143ec0587e7c6a481ffcf797f07219964f1.tar.gz | |
Merge pull request #2340 from pygments/anteru/fix-doc-references
Fix various documentation references.
| -rw-r--r-- | doc/docs/api.rst | 13 | ||||
| -rw-r--r-- | doc/docs/cmdline.rst | 2 | ||||
| -rw-r--r-- | doc/docs/lexerdevelopment.rst | 4 | ||||
| -rw-r--r-- | doc/docs/quickstart.rst | 8 | ||||
| -rw-r--r-- | doc/docs/styles.rst | 2 |
5 files changed, 16 insertions, 13 deletions
diff --git a/doc/docs/api.rst b/doc/docs/api.rst index 4d330bf8..b7a2a411 100644 --- a/doc/docs/api.rst +++ b/doc/docs/api.rst @@ -1,6 +1,3 @@ -.. -*- mode: rst -*- - -===================== The full Pygments API ===================== @@ -70,7 +67,7 @@ Functions from :mod:`pygments.lexers`: the input, because this method is equivalent to running eval on the input file. The lexer is given the `options` at its instantiation. - :exc:`ClassNotFound` is raised if there are any errors loading the Lexer + :exc:`pygments.util.ClassNotFound` is raised if there are any errors loading the Lexer .. versionadded:: 2.2 @@ -145,7 +142,7 @@ Functions from :mod:`pygments.formatters`: careful with the input, because this method is equivalent to running eval on the input file. The formatter is given the `options` at its instantiation. - :exc:`ClassNotFound` is raised if there are any errors loading the Formatter + :exc:`pygments.util.ClassNotFound` is raised if there are any errors loading the Formatter .. versionadded:: 2.2 @@ -257,6 +254,12 @@ The base lexer class from which all lexers are derived is: A list of MIME types for content that can be lexed with this lexer. +There are several base class derived from ``Lexer`` you can use to build your lexer from: + +.. autoclass:: pygments.lexer.DelegatingLexer +.. autoclass:: pygments.lexer.RegexLexer +.. autoclass:: pygments.lexer.ExtendedRegexLexer + .. module:: pygments.formatter diff --git a/doc/docs/cmdline.rst b/doc/docs/cmdline.rst index b07b3e4e..477e61af 100644 --- a/doc/docs/cmdline.rst +++ b/doc/docs/cmdline.rst @@ -96,7 +96,7 @@ the "colorful" style prepending a ".syntax" selector to all style rules. For an explanation what ``-a`` means for :doc:`a particular formatter <formatters>`, look for the `arg` argument for the formatter's -:meth:`.get_style_defs()` method. +:meth:`.get_style_defs() <pygments.formatter.Formatter.get_style_defs()>` method. Getting lexer names diff --git a/doc/docs/lexerdevelopment.rst b/doc/docs/lexerdevelopment.rst index 354b1d43..0809e75e 100644 --- a/doc/docs/lexerdevelopment.rst +++ b/doc/docs/lexerdevelopment.rst @@ -24,7 +24,7 @@ RegexLexer ========== The lexer base class used by almost all of Pygments' lexers is the -:class:`RegexLexer`. This class allows you to define lexing rules in terms of +:class:`RegexLexer <pygments.lexer.RegexLexer>`. This class allows you to define lexing rules in terms of *regular expressions* for different *states*. States are groups of regular expressions that are matched against the input @@ -131,7 +131,7 @@ If you only want to use your lexer with the Pygments API, you can import and instantiate the lexer yourself, then pass it to :func:`pygments.highlight`. Use the ``-f`` flag to select a different output format than terminal -escape sequences. The :class:`pygments.formatters.html.HtmlFormatter` helps +escape sequences. The :class:`.HtmlFormatter` helps you with debugging your lexer. You can use the ``debug_token_types`` option to display the token types assigned to each part of your input file: diff --git a/doc/docs/quickstart.rst b/doc/docs/quickstart.rst index b2a9c290..d9ddc7c0 100644 --- a/doc/docs/quickstart.rst +++ b/doc/docs/quickstart.rst @@ -58,7 +58,7 @@ can be produced by: print(HtmlFormatter().get_style_defs('.highlight')) -The argument to :func:`get_style_defs` is used as an additional CSS selector: +The argument to :meth:`get_style_defs() <pygments.formatter.Formatter.get_style_defs()>` is used as an additional CSS selector: the output may look like this: .. sourcecode:: css @@ -71,7 +71,7 @@ the output may look like this: Options ======= -The :func:`highlight()` function supports a fourth argument called *outfile*, it +The :func:`highlight() <pygments.highlight>` function supports a fourth argument called *outfile*, it must be a file object if given. The formatted output will then be written to this file instead of being returned as a string. @@ -153,8 +153,8 @@ or some template tags), use these functions: >>> guess_lexer_for_filename('test.py', 'print "Hello World!"') <pygments.lexers.PythonLexer> -:func:`.guess_lexer()` passes the given content to the lexer classes' -:meth:`analyse_text()` method and returns the one for which it returns the +:func:`.guess_lexer() <pygments.lexers.guess_lexer>` passes the given content to the lexer classes' +:meth:`analyse_text() <pygments.lexer.Lexer.analyse_text>` method and returns the one for which it returns the highest number. All lexers have two different filename pattern lists: the primary and the diff --git a/doc/docs/styles.rst b/doc/docs/styles.rst index 91689d30..7c2d382c 100644 --- a/doc/docs/styles.rst +++ b/doc/docs/styles.rst @@ -79,7 +79,7 @@ Terminal Styles Custom styles used with the 256-color terminal formatter can also map colors to use the 8 default ANSI colors. To do so, use ``ansigreen``, ``ansibrightred`` or -any other colors defined in :attr:`pygments.style.ansicolors`. Foreground ANSI +any other colors defined in :data:`pygments.style.ansicolors`. Foreground ANSI colors will be mapped to the corresponding `escape codes 30 to 37 <https://en.wikipedia.org/wiki/ANSI_escape_code#Colors>`_ thus respecting any custom color mapping and themes provided by many terminal emulators. Light |
