Commit Graph
45 Commits
Author SHA1 Message Date
Jeremy Maitin-Shepard 7a4ce71f6b Include source in highlighting warnings (#11150)
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.
2023-03-17 15:32:27 +00:00
Adam Turner 9ced736316 Fix highlighting lexers
- Ensure `pycon3` is always normalised to `pycon`
2022-09-25 00:10:59 +01:00
Adam Turner 5775912455 Collapse single line docstrings 2022-02-20 03:13:45 +00:00
Adam Turner 6bb7b891a1 Remove copyright and licence fields 2022-02-20 03:06:23 +00:00
Adam Turner 5694e0ce60 Fix module docstring indentation 2022-02-20 00:35:13 +00:00
Adam Turner 4f5a3269a6 Fix module docstring first line 2022-02-20 00:11:08 +00:00
Adam Turner 6b8bccec59 Remove module titles in docstrings 2022-02-19 23:17:29 +00:00
Takeshi KOMIYA b84771dcd2 A happy new year! 2022-01-01 18:45:03 +09:00
Takeshi KOMIYA f996859420 A happy new year!
.. note::

   $ find sphinx tests LICENSE doc/conf.py -type f -exec sed -i '' -e 's/2007\-20../2007-2021/' {} \;
   $ git co sphinx/locale/**/*.js sphinx/templates/epub3/mimetype
2021-01-01 13:40:48 +09:00
François Freitag 0949735210 Sort imports with isort
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.
2020-11-11 13:19:05 +01:00
Takeshi KOMIYA 57d63ab50b test: testcase for add_lexer() should give a Lexer class instead of instance 2020-02-16 20:42:43 +09:00
Takeshi KOMIYA eaf495c3c4 A happy new year! 2020-01-01 14:27:43 +09:00
Takeshi KOMIYA c83f2a0272 Fix #6140: Use unittest.mock instead of mock 2019-03-08 00:27:45 +09:00
Takeshi KOMIYA 76e9f57c2e Merge branch '1.8' 2019-01-02 16:16:25 +09:00
Takeshi KOMIYA 1b1ebd2c75 A happy new year! 2019-01-02 16:00:30 +09:00
Jon Dufresne bade33c7e4 Remove unnecessary encoding cookie from Python source files
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.
2018-12-16 12:22:12 -08:00
Takeshi KOMIYA 2bafb53179 Add testcase for trim_doctest_flags 2018-07-21 11:46:08 +09:00
Takeshi KOMIYA f7027049b1 Fix flake8 violations 2018-02-19 23:20:56 +09:00
Takeshi KOMIYA 2426cedb8b A happy new year! 2018-01-01 01:06:58 +09:00
Takeshi KOMIYA 8f9dd64992 Merge branch 'stable' 2017-03-26 11:52:15 +09:00
Takeshi KOMIYA c57e47e042 Year++ 2017-03-26 11:49:34 +09:00
shimizukawa 4c22cd10ca Merge branch 'stable' 2017-01-07 02:14:29 +09:00
shimizukawa baaef9146d pytest: remove deprecated with_app decorator functions 2017-01-06 01:14:47 +09:00
Takeshi KOMIYA 6bf201533a Fix style-check violation 2017-01-02 12:59:51 +09:00
Takeshi KOMIYA 85dcd7baa8 Use sphinx.util.logging instead app.warn() 2017-01-02 12:59:50 +09:00
Takeshi KOMIYA 80921b2ab8 Fix flake8 violation under tests/ 2016-06-12 00:02:11 +09:00
Takeshi KOMIYA 2b93e09c0a Highlighting fallbacks by default
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.
2016-02-20 00:44:28 +09:00
Georg Brandl 46d7e8558e Obligatory copyright update. 2016-01-14 22:54:04 +01:00
EricFromCanada a63e4945ea Add highlight_options configuration value
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.
2015-01-05 12:58:43 -05:00
Georg Brandl a23903d8d5 Merge branch 'stable' 2015-01-03 21:41:14 +01:00
Georg Brandl 567d52f199 all: update copyright 2015-01-03 21:36:32 +01:00
Georg Brandl d47a7587f9 Complete test suite overhaul.
* 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
2014-09-21 17:17:02 +02:00
Georg Brandl e030031321 Update copyright year. 2014-03-01 08:18:16 +01:00
Georg Brandl 1af3e3ea71 tests: replace "from util import *" by explicit imports 2013-04-01 11:39:32 +02:00
Georg Brandl 151856819c Copyright update. 2013-01-01 22:13:15 +01:00
Georg Brandl 0e1db6ad90 New year update. 2011-01-04 10:00:51 +01:00
Georg Brandl 47ccbccc62 merge with 0.6 2010-01-01 14:10:48 +01:00
Georg Brandl f6a56192d1 Happy new year! 2010-01-01 14:09:13 +01:00
Georg Brandl 0ed845462f #169: Added the `trim_doctest_flags` config value, which is true by default. 2009-06-16 21:53:53 +02:00
Georg Brandl 1e347aba51 Skip pygments-related tests if it is not installed. 2009-02-06 22:18:16 +01:00
Georg Brandl f16f94f2cd Merge in copyright style changes from 0.5. 2009-01-03 12:15:19 +01:00
Benjamin Peterson bb6b7d9b31 add a test for detecting python console sessions 2009-01-01 10:33:41 -06:00
Georg Brandl 26d7aafaae Explicitly refer to the license in :license: tags. 2008-12-27 12:19:17 +01:00
Georg Brandl c450bab147 Allow using different Pygments formatters. 2008-11-30 20:29:34 +01:00
Georg Brandl 50339493c6 Add Sphinx.add_lexer(). 2008-11-30 19:58:29 +01:00