Fix #4137: doctest: Make doctest and testcode blocks highlighted

This commit is contained in:
Takeshi KOMIYA 2017-10-12 22:57:20 +09:00
parent de023f2dc0
commit eebf9d0a0e
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
* #4079: html: Add ``notranslate`` class to each code-blocks, literals and maths
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
----------------

View File

@ -116,7 +116,11 @@ class TestDirective(Directive):
if test is not None:
# only save if it differs from code
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
node['language'] = 'none'
node['options'] = {}