##// END OF EJS Templates
Make sure splitter._buffer is reset. Handle suppressed output better
Skipper Seabold -
Show More
@@ -300,6 +300,10 b' class EmbeddedSphinxShell(object):'
300 decorator.startswith('@savefig')
300 decorator.startswith('@savefig')
301
301
302 input_lines = input.split('\n')
302 input_lines = input.split('\n')
303 if len(input_lines) > 1:
304 if input_lines[-1] != "":
305 input_lines.append('') # make sure there's a blank line
306 # so splitter buffer gets reset
303
307
304 continuation = ' %s:'%''.join(['.']*(len(str(lineno))+2))
308 continuation = ' %s:'%''.join(['.']*(len(str(lineno))+2))
305 Nc = len(continuation)
309 Nc = len(continuation)
@@ -314,7 +318,7 b' class EmbeddedSphinxShell(object):'
314 for i, line in enumerate(input_lines):
318 for i, line in enumerate(input_lines):
315 if line.endswith(';'):
319 if line.endswith(';'):
316 is_semicolon = True
320 is_semicolon = True
317 if is_semicolon or is_suppress:
321 if is_suppress:
318 store_history = False
322 store_history = False
319
323
320 if i==0:
324 if i==0:
@@ -336,18 +340,18 b' class EmbeddedSphinxShell(object):'
336 if not is_suppress:
340 if not is_suppress:
337 ret.append(formatted_line)
341 ret.append(formatted_line)
338
342
339 if not is_suppress:
343 if not is_suppress and len(rest.strip()) and is_verbatim:
340 if len(rest.strip()):
344 # the "rest" is the standard output of the
341 if is_verbatim:
345 # input, which needs to be added in
342 # the "rest" is the standard output of the
346 # verbatim mode
343 # input, which needs to be added in
347 ret.append(rest)
344 # verbatim mode
345 ret.append(rest)
346
348
347 self.cout.seek(0)
349 self.cout.seek(0)
348 output = self.cout.read()
350 output = self.cout.read()
349 if not is_suppress and not is_semicolon:
351 if not is_suppress and not is_semicolon:
350 ret.append(output)
352 ret.append(output)
353 elif is_semicolon: # get spacing right
354 ret.append('')
351
355
352 self.cout.truncate(0)
356 self.cout.truncate(0)
353 return (ret, input_lines, output, is_doctest, image_file,
357 return (ret, input_lines, output, is_doctest, image_file,
General Comments 0
You need to be logged in to leave comments. Login now