Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: fix cython magic support in ipython_directive #4803

Merged
merged 1 commit into from Jan 24, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion IPython/sphinxext/ipython_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] == ' ':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize this has been merged already, but this fix seems awfully cryptic...the sort of thing that no will remember why it is there a year from now (except if they search through github issues). Would it be possible to add an explanation for why, in the first place, it is necessary to determine if the line begins with a whitespace and then why it must be removed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See here, If ipython doesn't know whether there's a space after the colon, neither can I.
The if and checks are defensive so that I don't slice off the first character of the input
by presuming a space.

nextline = nextline[1:]

inputline += '\n' + nextline
else:
rest.append(nextline)
i+= 1
Expand Down