From 01fc30e9b21bed198df12502414b535e8f3798d9 2014-01-15 01:22:54 From: y-p Date: 2014-01-15 01:22:54 Subject: [PATCH] BUG: ipython_directive now supports cython magic (remove dangling space) GH4791 --- diff --git a/IPython/sphinxext/ipython_directive.py b/IPython/sphinxext/ipython_directive.py index d9e48f9..ef6f71e 100644 --- a/IPython/sphinxext/ipython_directive.py +++ b/IPython/sphinxext/ipython_directive.py @@ -216,7 +216,11 @@ def block_parser(part, rgxin, rgxout, fmtin, fmtout): if matchout or nextline.startswith('#'): break elif nextline.startswith(continuation): - inputline += '\n' + nextline[Nc:] + nextline = nextline[Nc:] + if nextline and nextline[0] == ' ': + nextline = nextline[1:] + + inputline += '\n' + nextline else: rest.append(nextline) i+= 1