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

magic_arguments: dedent but otherwise preserve indentation. #1921

Merged
merged 1 commit into from Jun 12, 2012

Conversation

bfroehle
Copy link
Contributor

Previously magic_arguments stripped all whitespace at the beginning of each line, interfering with formatting syntax which relies on indentation to give context (e.g., code blocks). Now the docstring text is passed through dedent to strip the global indentation before being handed off to RawDescriptionHelpFormatter which preserves any remaining indentation.

Thanks to @rkern for suggesting the solution approach.

Closes gh-1890.

Previously magic_arguments stripped all whitespace at the beginning of
each line, interfering with formatting syntax which relies on indentation
to give context (e.g., code blocks). Now the docstring text is passed
through dedent to strip the global indentation before being handed off
to RawDescriptionHelpFormatter which preserves any remaining indentation.

Thanks to @rkern for suggesting the solution approach.

Closes ipythongh-1890.
@fperez
Copy link
Member

fperez commented Jun 12, 2012

Awesome!! Rebuilding our docs right now... Many, many thanks. I was kind of embarrassed to have all these new fancy magics with completely unreadable docstrings. @jonathan-taylor should be happy about this fix. Merging now.

fperez added a commit that referenced this pull request Jun 12, 2012
magic_arguments: dedent but otherwise preserve indentation.

Previously magic_arguments stripped all whitespace at the beginning of each line, interfering with formatting syntax which relies on indentation to give context (e.g., code blocks). Now the docstring text is passed through dedent to strip the global indentation before being handed off to `RawDescriptionHelpFormatter` which preserves any remaining indentation.

Thanks to @rkern for suggesting the solution approach.

Closes gh-1890.
@fperez fperez merged commit 673e533 into ipython:master Jun 12, 2012
@minrk
Copy link
Member

minrk commented Jun 12, 2012

Test results for commit df97f2d (can't merge cleanly)
Platform: darwin

Not available for testing: python3.1

@minrk
Copy link
Member

minrk commented Jun 12, 2012

This introduced failing tests.

@fperez
Copy link
Member

fperez commented Jun 12, 2012

Ouch, I didn't even think of that since it was only doing docstrings!! I did build the docs and they looked way better, so I thought we'd be clear. Sorry about that... Will look into it as soon as I can

@minrk
Copy link
Member

minrk commented Jun 12, 2012

I think it's just a tiny test of the docstring output, which assumed the behavior this changes. Not an actual bug, so it should just be a matter of pasting in the new output.

@fperez
Copy link
Member

fperez commented Jun 12, 2012

OK, I've just pushed the fix straight to master. test_pr should work reliably again. Sorry about the mess.

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
…ocstring

magic_arguments: dedent but otherwise preserve indentation.

Previously magic_arguments stripped all whitespace at the beginning of each line, interfering with formatting syntax which relies on indentation to give context (e.g., code blocks). Now the docstring text is passed through dedent to strip the global indentation before being handed off to `RawDescriptionHelpFormatter` which preserves any remaining indentation.

Thanks to @rkern for suggesting the solution approach.

Closes ipythongh-1890.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docstrings for magics that use @magic_arguments are rendered wrong
3 participants