Skip to content

Commit ce44442

Browse files
author
y-p
committed
BLD: ipython_directive, cython magic fix
1 parent bdceb19 commit ce44442

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

doc/sphinxext/ipython_directive.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,12 @@ def block_parser(part, rgxin, rgxout, fmtin, fmtout):
217217
if matchout or nextline.startswith('#'):
218218
break
219219
elif nextline.startswith(continuation):
220-
inputline += '\n' + nextline[Nc:]
220+
nextline = nextline[Nc:]
221+
if nextline and nextline[0] == ' ':
222+
nextline = nextline[1:]
223+
224+
inputline += '\n' + nextline
225+
221226
else:
222227
rest.append(nextline)
223228
i+= 1
@@ -363,10 +368,16 @@ def process_input(self, data, input_prompt, lineno):
363368
is_savefig = decorator is not None and \
364369
decorator.startswith('@savefig')
365370

371+
# #>>> required for cython magic to work
372+
# def _remove_first_space_if_any(line):
373+
# return line[1:] if line.startswith(' ') else line
374+
375+
# input_lines = lmap(_remove_first_space_if_any, input.split('\n'))
366376
input_lines = input.split('\n')
377+
367378
if len(input_lines) > 1:
368-
if input_lines[-1] != "":
369-
input_lines.append('') # make sure there's a blank line
379+
if input_lines[-1] != "":
380+
input_lines.append('') # make sure there's a blank line
370381
# so splitter buffer gets reset
371382

372383
continuation = ' %s:'%''.join(['.']*(len(str(lineno))+2))

0 commit comments

Comments
 (0)