Guenter Milde wrote:
On 2010-04-19, Howard Butler wrote:
I am getting it too, though on older versions of sphinx + docutils, it
doesn't happen, and I think it is because something has gotten more
strict. I have also tried adjusting the offending docstring multiple
ways, and I can't figure out *what* exactly it doesn't like about the
indentation.
You might try to copy the docstring (without the quotes!) to a text
file and run Docutil's rst2html.py on it to get more info.
(As many Sphinx directives and roles are unknown to "pure"
rst, you might have to eliminate some "false positives".)
Your best bet rather than just copy and paste is something along the
lines of:
$ python
>>> from docutils.core import publish_parts
>>> publish_parts(myfunc.__doc__)
This should make it a bit more obvious when you encounter what I would
guess to be one of the most likely non-obvious causes of formatting
errors from docstrings, which is docstrings in a form like:
def myfunc():
"""This is the first line.
More lines here.
Another line.
So forth."""
If you check myfunc.__doc__, you'll see that the first line has no
indentation and all of the remaining lines have indentation:
This is the first line.
More lines here.
Another line.
So forth.
I think that generally your best bet is to prefer docstrings like so:
def myfunc():
"""
This is the first line.
More lines here.
Another line.
So forth.
"""
(I think the second docstring just looks better/cleaner as well, but I
realize that some people prefer the "jagged" original.)
--
--Max Battcher--
http://worldmaker.net
--
You received this message because you are subscribed to the Google Groups
"sphinx-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sphinx-dev?hl=en.