Merge pull request #4143 from tk0miya/4137_doctest_force_highlight_pycon

Fix #4137: doctest: doctest block is always highlighted as python con…
This commit is contained in:
Takeshi KOMIYA
2018-01-15 00:12:44 +09:00
committed by GitHub
2 changed files with 7 additions and 1 deletions

View File

@@ -86,6 +86,8 @@ Features added
* #4245: html themes: Add ``language`` to javascript vars list * #4245: html themes: Add ``language`` to javascript vars list
* #4079: html: Add ``notranslate`` class to each code-blocks, literals and maths * #4079: html: Add ``notranslate`` class to each code-blocks, literals and maths
to let Google Translate know they are not translatable to let Google Translate know they are not translatable
* #4137: doctest: doctest block is always highlighted as python console (pycon)
* #4137: doctest: testcode block is always highlighted as python
Features removed Features removed
---------------- ----------------

View File

@@ -116,7 +116,11 @@ class TestDirective(Directive):
if test is not None: if test is not None:
# only save if it differs from code # only save if it differs from code
node['test'] = test node['test'] = test
if self.name == 'testoutput': if self.name == 'doctest':
node['language'] = 'pycon'
elif self.name == 'testcode':
node['language'] = 'python'
elif self.name == 'testoutput':
# don't try to highlight output # don't try to highlight output
node['language'] = 'none' node['language'] = 'none'
node['options'] = {} node['options'] = {}