`sphinx.highlighting.PygmentsBridge.unhighlight()` is deprecated

This commit is contained in:
Takeshi KOMIYA 2018-07-20 01:37:31 +09:00
parent f272d6876c
commit 0c277f3ff0
3 changed files with 11 additions and 0 deletions

View File

@ -102,6 +102,7 @@ Deprecated
* ``sphinx.ext.mathbase.eqref`` node is deprecated * ``sphinx.ext.mathbase.eqref`` node is deprecated
* ``sphinx.ext.mathbase.is_in_section_title()`` is deprecated * ``sphinx.ext.mathbase.is_in_section_title()`` is deprecated
* ``sphinx.ext.mathbase.MathDomain`` is deprecated * ``sphinx.ext.mathbase.MathDomain`` is deprecated
* ``sphinx.highlighting.PygmentsBridge.unhighlight()`` is deprecated
For more details, see `deprecation APIs list For more details, see `deprecation APIs list
<http://www.sphinx-doc.org/en/master/extdev/index.html#deprecated-apis>`_ <http://www.sphinx-doc.org/en/master/extdev/index.html#deprecated-apis>`_

View File

@ -131,6 +131,11 @@ The following is a list of deprecated interface.
- 4.0 - 4.0
- :meth:`~sphinx.application.Sphinx.add_js_file()` - :meth:`~sphinx.application.Sphinx.add_js_file()`
* - ``sphinx.highlighting.PygmentsBridge.unhighlight()``
- 1.8
- 3.0
- N/A
* - ``sphinx.ext.mathbase.MathDomain`` * - ``sphinx.ext.mathbase.MathDomain``
- 1.8 - 1.8
- 3.0 - 3.0

View File

@ -9,6 +9,8 @@
:license: BSD, see LICENSE for details. :license: BSD, see LICENSE for details.
""" """
import warnings
from pygments import highlight from pygments import highlight
from pygments.filters import ErrorToken from pygments.filters import ErrorToken
from pygments.formatters import HtmlFormatter, LatexFormatter from pygments.formatters import HtmlFormatter, LatexFormatter
@ -20,6 +22,7 @@ from pygments.styles import get_style_by_name
from pygments.util import ClassNotFound from pygments.util import ClassNotFound
from six import text_type from six import text_type
from sphinx.deprecation import RemovedInSphinx30Warning
from sphinx.ext import doctest from sphinx.ext import doctest
from sphinx.locale import __ from sphinx.locale import __
from sphinx.pygments_styles import SphinxStyle, NoneStyle from sphinx.pygments_styles import SphinxStyle, NoneStyle
@ -93,6 +96,8 @@ class PygmentsBridge(object):
def unhighlighted(self, source): def unhighlighted(self, source):
# type: (unicode) -> unicode # type: (unicode) -> unicode
warnings.warn('PygmentsBridge.unhighlighted() is now deprecated.',
RemovedInSphinx30Warning)
if self.dest == 'html': if self.dest == 'html':
return '<pre>' + htmlescape(source) + '</pre>\n' return '<pre>' + htmlescape(source) + '</pre>\n'
else: else: