From 04723c1175b856d309a2e6ce18835ae675311ba3 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Fri, 24 Jun 2016 11:35:15 +0900 Subject: [PATCH] Fix #2479: `sphinx.ext.viewcode` uses python2 highlighter by default --- CHANGES | 1 + sphinx/ext/viewcode.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 6f1745e5e..230be37c9 100644 --- a/CHANGES +++ b/CHANGES @@ -28,6 +28,7 @@ Bugs fixed * #2679: ``float`` package needed for ``'figure_align': 'H'`` latex option * #2671: image directive may lead to inconsistent spacing in pdf * #2705: `toctree` generates empty bullet_list if ``:titlesonly:`` specified +* #2479: `sphinx.ext.viewcode` uses python2 highlighter by default Release 1.4.4 (released Jun 12, 2016) diff --git a/sphinx/ext/viewcode.py b/sphinx/ext/viewcode.py index 89e7a9965..a071c5533 100644 --- a/sphinx/ext/viewcode.py +++ b/sphinx/ext/viewcode.py @@ -139,8 +139,8 @@ def collect_pages(app): # construct a page name for the highlighted source pagename = '_modules/' + modname.replace('.', '/') # highlight the source using the builder's highlighter - if env.config.highlight_language == 'python3': - lexer = 'python3' + if env.config.highlight_language in ('python3', 'default'): + lexer = env.config.highlight_language else: lexer = 'python' highlighted = highlighter.highlight_block(code, lexer, linenos=False)