Commits

Georg Brandl committed a73ed4d

Small API change.

Comments (0)

Files changed (2)

sphinx/ext/autodoc.py

                         docstrings.append(initdocstring)
             # the default is only the class docstring
 
-        # make sure we get Unicode docstrings
-        return [force_decode(docstring, encoding) for docstring in docstrings]
+        # make sure we have Unicode docstrings, then sanitize and split into lines
+        return [prepare_docstring(force_decode(docstring, encoding))
+                for docstring in docstrings]
 
     def process_doc(self, docstrings, what, name, obj):
         """Let the user process the docstrings."""
         # add content from docstrings
         if not no_docstring:
             encoding = analyzer and analyzer.encoding
-            docstrings = map(prepare_docstring,
-                             self.get_doc(what, todoc, encoding))
+            docstrings = self.get_doc(what, todoc, encoding)
             for i, line in enumerate(self.process_doc(docstrings, what,
                                                       fullname, todoc)):
                 self.result.append(indent + line, sourcename, i)

tests/test_autodoc.py

 from docutils.statemachine import ViewList
 
 from sphinx.ext.autodoc import RstGenerator, cut_lines, between
-from sphinx.util.docstrings import prepare_docstring
 
 
 def setup_module():
 
 def test_get_doc():
     def getdocl(*args):
-        ds = map(prepare_docstring, gen.get_doc(*args))
+        ds = gen.get_doc(*args)
         # for testing purposes, concat them and strip the empty line at the end
         return sum(ds, [])[:-1]
 
 
 def test_docstring_processing():
     def process(what, name, obj):
-        return list(gen.process_doc(map(prepare_docstring, gen.get_doc(what, obj)),
-                                    what, name, obj))
+        return list(gen.process_doc(gen.get_doc(what, obj), what, name, obj))
 
     class E:
         def __init__(self):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.