summaryrefslogtreecommitdiff
path: root/sphinx/highlighting.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-11-19 02:02:37 +0900
committerGitHub <noreply@github.com>2019-11-19 02:02:37 +0900
commitaa882e947c4e49593f337fb223a527fc18dc2a0b (patch)
tree6521a26d897841ce5fe879184e78e843b28e3c36 /sphinx/highlighting.py
parent948ac3a1f07e954e51938678334a984ca1216145 (diff)
parentf3469bcc8fedac8c196a3df7e71a8a47300dcb64 (diff)
downloadsphinx-git-aa882e947c4e49593f337fb223a527fc18dc2a0b.tar.gz
Merge pull request #6834 from tk0miya/6738_deprecated_tex_escape_map
Reconsider public APIs of sphinx.util.texescape
Diffstat (limited to 'sphinx/highlighting.py')
-rw-r--r--sphinx/highlighting.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py
index 0a6cf8d6e..6804b9de0 100644
--- a/sphinx/highlighting.py
+++ b/sphinx/highlighting.py
@@ -27,8 +27,7 @@ from sphinx.deprecation import RemovedInSphinx30Warning
from sphinx.ext import doctest
from sphinx.locale import __
from sphinx.pygments_styles import SphinxStyle, NoneStyle
-from sphinx.util import logging
-from sphinx.util.texescape import get_hlescape_func, tex_hl_escape_map_new
+from sphinx.util import logging, texescape
if False:
# For type annotation
@@ -114,7 +113,7 @@ class PygmentsBridge:
# first, escape highlighting characters like Pygments does
source = source.translate(escape_hl_chars)
# then, escape all characters nonrepresentable in LaTeX
- source = source.translate(tex_hl_escape_map_new)
+ source = texescape.escape(source, self.latex_engine)
return '\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n' + \
source + '\\end{Verbatim}\n'
@@ -194,8 +193,7 @@ class PygmentsBridge:
if self.dest == 'html':
return hlsource
else:
- escape = get_hlescape_func(self.latex_engine)
- return escape(hlsource)
+ return texescape.hlescape(hlsource, self.latex_engine)
def get_stylesheet(self):
# type: () -> str