If pygments fails to lex a source string as the specified highlight
language, Sphinx prints a warning. Previously, that warning did not
include the actual source text, although it does include location
information.
However, in some cases the location information may be missing, there
may be multiple highlighted literals on the same line, or the rST is
automatically generated somehow. In such cases, it can be difficult
to determine the source text that led to the error.
With this change, the source text is included in the warning.
Keep imports alphabetically sorted and their order homogeneous across
Python source files.
The isort project has more feature and is more active than the
flake8-import-order plugin.
Most issues caught were simply import ordering from the same module.
Where imports were purposefully placed out of order, tag with
isort:skip.
In Python 3, the default encoding of source files is utf-8. The encoding
cookie is now unnecessary and redundant so remove it. For more details,
see the docs:
https://docs.python.org/3/howto/unicode.html#the-string-type
> The default encoding for Python source code is UTF-8, so you can
> simply include a Unicode character in a string literal ...
Includes a fix for the flake8 header checks to stop expecting an
encoding cookie.
In 423bf7b, I tried to add fallback mechanism to ``python3``. But it breaks
the python3 highlighting on python2 environment.
This adds ``'default'`` to highlighting languages; it works like
``'python3'``, but fallbacks if failed Highlighting. And this removes
try-parse step from ``'python3'`` language. Now, it highlights regardless of
runtime environments. Thanks to Yoshiki SHIBUKAWA.
This changeset adds the `highlight_options` configuration value, which
specifies a dict of key-value pairs to pass to the Pygments highlighter
specified with `highlight_language`. For example, specifying
`highlight_options = {'funcnamehighlighting' : False}` for the 'php'
lexer will disable function name highlighting.
Both the HTML and LaTeX writers have been updated to include the
options when calling `highlight_block()`, as long as the currently
selected language matches what was set with `highlight_language`, i.e.
not when modified by `highlight::` or `code-block::` directives.
* rename a few test modules to make the names more consistent
* do not copy/use Sphinx from build/ (unnecessary without 2to3)
* use a temporary dir for *all* test projects, the source tree
will stay pristine that way (default is tests/build)
* speed up tests by ~3x by splitting up test projects and avoiding
rebuilds