From f3469bcc8fedac8c196a3df7e71a8a47300dcb64 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 16 Nov 2019 19:22:34 +0900 Subject: Make escape() and hlescape() as public APIs of texescape --- sphinx/highlighting.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'sphinx/highlighting.py') 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 -- cgit v1.2.1