summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-02-12 23:50:48 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-02-12 23:50:48 +0900
commit9702f0ae612c22f74341d66f390d1cd9672cc175 (patch)
tree4fea369b85e3bf91d351f20566684e093678c8d8
parent5018422db35b5a1d09ac0a2866bc02677079ffdf (diff)
downloadsphinx-git-9702f0ae612c22f74341d66f390d1cd9672cc175.tar.gz
Fix #7139: ``code-block:: guess`` does not work
-rw-r--r--CHANGES1
-rw-r--r--sphinx/highlighting.py7
2 files changed, 2 insertions, 6 deletions
diff --git a/CHANGES b/CHANGES
index 10bf627fb..af9ed7af9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -60,6 +60,7 @@ Bugs fixed
generated automatically in signatures.
* #5637: autodoc: Incorrect handling of nested class names on show-inheritance
* #5637: inheritance_diagram: Incorrect handling of nested class names
+* #7139: ``code-block:: guess`` does not work
Testing
--------
diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py
index f3445d1bd..4dc9ce543 100644
--- a/sphinx/highlighting.py
+++ b/sphinx/highlighting.py
@@ -105,11 +105,6 @@ class PygmentsBridge:
lang = 'pycon3'
else:
lang = 'python3'
- elif lang == 'guess':
- try:
- lexer = guess_lexer(source)
- except Exception:
- lexer = lexers['none']
if lang in lexers:
# just return custom lexers here (without installing raiseonerror filter)
@@ -119,7 +114,7 @@ class PygmentsBridge:
else:
try:
if lang == 'guess':
- lexer = guess_lexer(lang, **opts)
+ lexer = guess_lexer(source, **opts)
else:
lexer = get_lexer_by_name(lang, **opts)
except ClassNotFound: