Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1612314

Browse files
Merge pull request #5 from ivanov/master
added stream cell type
2 parents 6d0b2c4 + a05dc9b commit 1612314

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

nbconvert.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,22 @@ def save(self,fname=None, encoding=None):
8686

8787
def render_heading(self,cell):
8888
raise NotImplementedError
89+
8990
def render_code(self,cell):
9091
raise NotImplementedError
92+
9193
def render_markdown(self,cell):
9294
raise NotImplementedError
95+
9396
def render_pyout(self,cell):
9497
raise NotImplementedError
98+
9599
def render_display_data(self,cell):
96100
raise NotImplementedError
97101

102+
def render_stream(self,cell):
103+
raise NotImplementedError
104+
98105
class ConverterRST(Converter):
99106
extension = 'rst'
100107
def render_heading(self,cell):
@@ -134,7 +141,7 @@ def render_pyout(self,output):
134141
Returns list."""
135142

136143
lines = ['Out[%s]:' % output.prompt_number, '']
137-
144+
138145
if 'latex' in output:
139146
lines.extend(rst_directive('.. math::', output.latex))
140147

@@ -160,7 +167,19 @@ def render_display_data(self,output):
160167
figures_counter += 1
161168
lines.append('.. image:: %s' % fname)
162169
lines.append('')
163-
170+
171+
return lines
172+
173+
def render_stream(self,output):
174+
"""convert stream part of a code cell to rst
175+
176+
Returns list."""
177+
178+
lines = []
179+
180+
if 'text' in output:
181+
lines.extend(rst_directive('.. parsed-literal::', output.text))
182+
164183
return lines
165184

166185
def rst2simplehtml(fname):

0 commit comments

Comments
 (0)