From 0c277f3ff007a464d7769c9561c449428d38dabc Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Fri, 20 Jul 2018 01:37:31 +0900 Subject: [PATCH] ``sphinx.highlighting.PygmentsBridge.unhighlight()`` is deprecated --- CHANGES | 1 + doc/extdev/index.rst | 5 +++++ sphinx/highlighting.py | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/CHANGES b/CHANGES index e57a0dad6..e1aa4e5f8 100644 --- a/CHANGES +++ b/CHANGES @@ -102,6 +102,7 @@ Deprecated * ``sphinx.ext.mathbase.eqref`` node is deprecated * ``sphinx.ext.mathbase.is_in_section_title()`` is deprecated * ``sphinx.ext.mathbase.MathDomain`` is deprecated +* ``sphinx.highlighting.PygmentsBridge.unhighlight()`` is deprecated For more details, see `deprecation APIs list `_ diff --git a/doc/extdev/index.rst b/doc/extdev/index.rst index 7aa6a7948..98824f7ed 100644 --- a/doc/extdev/index.rst +++ b/doc/extdev/index.rst @@ -131,6 +131,11 @@ The following is a list of deprecated interface. - 4.0 - :meth:`~sphinx.application.Sphinx.add_js_file()` + * - ``sphinx.highlighting.PygmentsBridge.unhighlight()`` + - 1.8 + - 3.0 + - N/A + * - ``sphinx.ext.mathbase.MathDomain`` - 1.8 - 3.0 diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py index dd248107c..f31ff88cc 100644 --- a/sphinx/highlighting.py +++ b/sphinx/highlighting.py @@ -9,6 +9,8 @@ :license: BSD, see LICENSE for details. """ +import warnings + from pygments import highlight from pygments.filters import ErrorToken from pygments.formatters import HtmlFormatter, LatexFormatter @@ -20,6 +22,7 @@ from pygments.styles import get_style_by_name from pygments.util import ClassNotFound from six import text_type +from sphinx.deprecation import RemovedInSphinx30Warning from sphinx.ext import doctest from sphinx.locale import __ from sphinx.pygments_styles import SphinxStyle, NoneStyle @@ -93,6 +96,8 @@ class PygmentsBridge(object): def unhighlighted(self, source): # type: (unicode) -> unicode + warnings.warn('PygmentsBridge.unhighlighted() is now deprecated.', + RemovedInSphinx30Warning) if self.dest == 'html': return '
' + htmlescape(source) + '
\n' else: