summaryrefslogtreecommitdiff
path: root/sphinx/highlighting.py
diff options
context:
space:
mode:
authortk0miya <i.tkomiya@gmail.com>2014-10-08 21:52:33 +0900
committertk0miya <i.tkomiya@gmail.com>2014-10-08 21:52:33 +0900
commitf51b945d897326548579847bb97f58a95e1a5bf1 (patch)
tree3d1b8122b2d48f3e564ae313412be8565fda468f /sphinx/highlighting.py
parent34709d3080111dc2da0ad68f04960a87fe167fa2 (diff)
downloadsphinx-git-f51b945d897326548579847bb97f58a95e1a5bf1.tar.gz
Add frame to code-block in LaTeX
Diffstat (limited to 'sphinx/highlighting.py')
-rw-r--r--sphinx/highlighting.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py
index c2d2e89a6..e257c3702 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}[commandchars=\\\\\\{\\}]\n' + \
+ return '\\begin{Verbatim}[frame=single,commandchars=\\\\\\{\\}]\n' + \
source + '\\end{Verbatim}\n'
def try_parse(self, src):
@@ -190,6 +190,8 @@ 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)