Merge pull request #4845 from tk0miya/deprecate_highlightlang_directive

Deprecate highlightlang directive
This commit is contained in:
Takeshi KOMIYA 2018-04-29 22:20:46 +09:00 committed by GitHub
commit 9c98af5382
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 26 additions and 7 deletions

View File

@ -48,6 +48,7 @@ Deprecated
* ``Config.check_types()`` is deprecated
* ``Config.check_unicode()`` is deprecated
* ``sphinx.application.CONFIG_FILENAME`` is deprecated
* ``highlightlang`` directive is deprecated
For more details, see `deprecation APIs list
<http://www.sphinx-doc.org/en/master/extdev/index.html#deprecated-apis>`_

View File

@ -1,4 +1,4 @@
.. highlightlang:: python
.. highlight:: python
.. _build-config:

View File

@ -116,6 +116,11 @@ The following is a list of deprecated interface.
- (will be) Removed
- Alternatives
* - :rst:dir:`highlightlang`
- 1.8
- 4.0
- :rst:dir:`highlight`
* - :meth:`~sphinx.application.Sphinx.add_stylesheet()`
- 1.8
- 4.0

View File

@ -1,4 +1,4 @@
.. highlightlang:: python
.. highlight:: python
.. _latex:

View File

@ -1,4 +1,4 @@
.. highlightlang:: python
.. highlight:: python
.. _markdown:

View File

@ -1,4 +1,4 @@
.. highlightlang:: python
.. highlight:: python
HTML theming support
====================

View File

@ -1,4 +1,4 @@
.. highlightlang:: rst
.. highlight:: rst
.. _rst-primer:

View File

@ -1,4 +1,4 @@
.. highlightlang:: rst
.. highlight:: rst
===========
Field Lists

View File

@ -9,6 +9,7 @@
import codecs
import sys
import warnings
from difflib import unified_diff
from docutils import nodes
@ -17,6 +18,7 @@ from docutils.statemachine import ViewList
from six import text_type
from sphinx import addnodes
from sphinx.deprecation import RemovedInSphinx40Warning
from sphinx.locale import __
from sphinx.util import logging
from sphinx.util import parselinenos
@ -59,6 +61,17 @@ class Highlight(SphinxDirective):
linenothreshold=linenothreshold)]
class HighlightLang(Highlight):
"""highlightlang directive (deprecated)"""
def run(self):
# type: () -> List[nodes.Node]
warnings.warn('highlightlang directive is deprecated. '
'Please use highlight directive instead.',
RemovedInSphinx40Warning)
return Highlight.run(self)
def dedent_lines(lines, dedent, location=None):
# type: (List[unicode], int, Any) -> List[unicode]
if not dedent:
@ -462,7 +475,7 @@ class LiteralInclude(SphinxDirective):
def setup(app):
# type: (Sphinx) -> Dict[unicode, Any]
directives.register_directive('highlight', Highlight)
directives.register_directive('highlightlang', Highlight) # old
directives.register_directive('highlightlang', HighlightLang)
directives.register_directive('code-block', CodeBlock)
directives.register_directive('sourcecode', CodeBlock)
directives.register_directive('literalinclude', LiteralInclude)