From 4428ecd6e86d1216664813fbe55559e9f0cf2cac Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Tue, 27 Jun 2017 17:40:34 -0700 Subject: [PATCH] Add ability to process Napolean docstrings. --- autoapi/mappers/base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autoapi/mappers/base.py b/autoapi/mappers/base.py index 4b5d23b..20e8834 100644 --- a/autoapi/mappers/base.py +++ b/autoapi/mappers/base.py @@ -8,6 +8,7 @@ from jinja2 import Environment, FileSystemLoader, TemplateNotFound from sphinx.util.console import darkgreen, bold from sphinx.util.osutil import ensuredir from sphinx.util.docstrings import prepare_docstring +from sphinx.ext.napoleon.docstring import GoogleDocstring, NumpyDocstring from ..settings import API_ROOT @@ -180,7 +181,10 @@ class SphinxMapperBase(object): ) def _wrapped_prepare(value): - return '\n'.join(prepare_docstring(value)) + preped_value = '\n'.join(prepare_docstring(value)) + numpy_value = str(NumpyDocstring(preped_value)) + final_value = str(GoogleDocstring(numpy_value)) + return final_value self.jinja_env.filters['prepare_docstring'] = _wrapped_prepare