From b563fa44f2d807f6c077ee9434abe5e92a9dc476 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 18 Jan 2015 15:32:01 +0900 Subject: [PATCH] Fix #1620: Use VerbatimBorderColor to add frame to code-block in LaTeX --- sphinx/highlighting.py | 4 +--- sphinx/texinputs/sphinx.sty | 4 ++-- tests/test_markup.py | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py index 58365b35c..22f53a45b 100644 --- a/sphinx/highlighting.py +++ b/sphinx/highlighting.py @@ -96,7 +96,7 @@ class PygmentsBridge(object): source = source.translate(escape_hl_chars) # then, escape all characters nonrepresentable in LaTeX source = source.translate(tex_hl_escape_map_new) - return '\\begin{Verbatim}[frame=single,commandchars=\\\\\\{\\}]\n' + \ + return '\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n' + \ source + '\\end{Verbatim}\n' def try_parse(self, src): @@ -190,8 +190,6 @@ class PygmentsBridge(object): if self.dest == 'html': return hlsource else: - hlsource = re.sub(r'(?<=\\begin{Verbatim}\[)(?=commandchars)', - r'frame=single,', hlsource) if not isinstance(hlsource, text_type): # Py2 / Pygments < 1.6 hlsource = hlsource.decode() return hlsource.translate(tex_hl_escape_map_new) diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 444b0373b..b28b204bc 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -39,10 +39,10 @@ \definecolor{TitleColor}{rgb}{0.126,0.263,0.361} \definecolor{InnerLinkColor}{rgb}{0.208,0.374,0.486} \definecolor{OuterLinkColor}{rgb}{0.216,0.439,0.388} -% Redefine these colors to something not white if you want to have colored +% Redefine these colors to something if you want to have colored % background and border for code examples. \definecolor{VerbatimColor}{rgb}{1,1,1} -\definecolor{VerbatimBorderColor}{rgb}{1,1,1} +\definecolor{VerbatimBorderColor}{rgb}{0,0,0} % Uncomment these two lines to ignore the paper size and make the page % size more like a typical published manual. diff --git a/tests/test_markup.py b/tests/test_markup.py index 2d915fcb1..d282d236d 100644 --- a/tests/test_markup.py +++ b/tests/test_markup.py @@ -136,7 +136,7 @@ def test_latex_escaping(): r'\(\Gamma\)\textbackslash{}\(\infty\)\$') # in verbatim code fragments yield (verify, u'::\n\n @Γ\\∞${}', None, - u'\\begin{Verbatim}[frame=single,commandchars=\\\\\\{\\}]\n' + u'\\begin{Verbatim}[commandchars=\\\\\\{\\}]\n' u'@\\(\\Gamma\\)\\PYGZbs{}\\(\\infty\\)\\PYGZdl{}\\PYGZob{}\\PYGZcb{}\n' u'\\end{Verbatim}') # in URIs