summaryrefslogtreecommitdiff
path: root/sphinx/directives/code.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-04-14 23:15:31 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2018-04-15 00:33:02 +0900
commitb35198d8475fe89aaf9a5224a9832fb394e73cca (patch)
treedf2f9cae51d5810a6ccbfc57b70996348ebe72a3 /sphinx/directives/code.py
parent19585962a2105ae93e3d17439baaa00c288163be (diff)
downloadsphinx-git-b35198d8475fe89aaf9a5224a9832fb394e73cca.tar.gz
Deprecate highlightlang directive
highlightlang directive is not documented, and marked as old in v0.2.
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r--sphinx/directives/code.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py
index 1c294ec7b..713e5ad0c 100644
--- a/sphinx/directives/code.py
+++ b/sphinx/directives/code.py
@@ -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)