diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-11-16 16:29:14 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-11-16 16:47:20 +0900 |
commit | 660e746cf801b9fce867a35a1ad3b65ae9ef43c5 (patch) | |
tree | b981f88e92573fe2ed479d5469d96c4b671ea8a4 /sphinx/highlighting.py | |
parent | ef09ea23feaf1d21faa3d5fd990a49fb14642bfa (diff) | |
download | sphinx-git-660e746cf801b9fce867a35a1ad3b65ae9ef43c5.tar.gz |
Fix #6738: latex: literal_block does not support raw unicode characters
Diffstat (limited to 'sphinx/highlighting.py')
-rw-r--r-- | sphinx/highlighting.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py index 977b71f28..0a6cf8d6e 100644 --- a/sphinx/highlighting.py +++ b/sphinx/highlighting.py @@ -28,7 +28,7 @@ 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 tex_hl_escape_map_new +from sphinx.util.texescape import get_hlescape_func, tex_hl_escape_map_new if False: # For type annotation @@ -68,9 +68,11 @@ class PygmentsBridge: html_formatter = HtmlFormatter latex_formatter = LatexFormatter - def __init__(self, dest='html', stylename='sphinx', trim_doctest_flags=None): - # type: (str, str, bool) -> None + def __init__(self, dest='html', stylename='sphinx', trim_doctest_flags=None, + latex_engine=None): + # type: (str, str, bool, str) -> None self.dest = dest + self.latex_engine = latex_engine style = self.get_style(stylename) self.formatter_args = {'style': style} # type: Dict[str, Any] @@ -192,7 +194,8 @@ class PygmentsBridge: if self.dest == 'html': return hlsource else: - return hlsource.translate(tex_hl_escape_map_new) + escape = get_hlescape_func(self.latex_engine) + return escape(hlsource) def get_stylesheet(self): # type: () -> str |