diff options
Diffstat (limited to 'sphinx/highlighting.py')
-rw-r--r-- | sphinx/highlighting.py | 8 |
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 |