Show More
@@ -524,7 +524,7 class EmbeddedSphinxShell(object): | |||
|
524 | 524 | |
|
525 | 525 | return output |
|
526 | 526 | |
|
527 |
class I |
|
|
527 | class IPythonDirective(Directive): | |
|
528 | 528 | |
|
529 | 529 | has_content = True |
|
530 | 530 | required_arguments = 0 |
@@ -536,7 +536,7 class IpythonDirective(Directive): | |||
|
536 | 536 | 'doctest' : directives.flag, |
|
537 | 537 | } |
|
538 | 538 | |
|
539 | shell = EmbeddedSphinxShell() | |
|
539 | shell = None | |
|
540 | 540 | |
|
541 | 541 | seen_docs = set() |
|
542 | 542 | |
@@ -563,11 +563,12 class IpythonDirective(Directive): | |||
|
563 | 563 | return savefig_dir, source_dir, rgxin, rgxout, promptin, promptout |
|
564 | 564 | |
|
565 | 565 | def setup(self): |
|
566 | if self.shell is None: | |
|
567 | self.shell = EmbeddedSphinxShell() | |
|
566 | 568 | # reset the execution count if we haven't processed this doc |
|
567 | 569 | #NOTE: this may be borked if there are multiple seen_doc tmp files |
|
568 | 570 | #check time stamp? |
|
569 | 571 | |
|
570 | ||
|
571 | 572 | if not self.state.document.current_source in self.seen_docs: |
|
572 | 573 | self.shell.IP.history_manager.reset() |
|
573 | 574 | self.shell.IP.execution_count = 1 |
@@ -668,7 +669,7 class IpythonDirective(Directive): | |||
|
668 | 669 | def setup(app): |
|
669 | 670 | setup.app = app |
|
670 | 671 | |
|
671 |
app.add_directive('ipython', I |
|
|
672 | app.add_directive('ipython', IPythonDirective) | |
|
672 | 673 | app.add_config_value('ipython_savefig_dir', None, True) |
|
673 | 674 | app.add_config_value('ipython_rgxin', |
|
674 | 675 | re.compile('In \[(\d+)\]:\s?(.*)\s*'), True) |
@@ -814,7 +815,7 In [153]: grid(True) | |||
|
814 | 815 | options = dict() |
|
815 | 816 | for example in examples: |
|
816 | 817 | content = example.split('\n') |
|
817 |
|
|
|
818 | IPythonDirective('debug', arguments=None, options=options, | |
|
818 | 819 | content=content, lineno=0, |
|
819 | 820 | content_offset=None, block_text=None, |
|
820 | 821 | state=None, state_machine=None, |
General Comments 0
You need to be logged in to leave comments.
Login now