diff --git a/README.rst b/README.rst index c238e87..2c76a9b 100644 --- a/README.rst +++ b/README.rst @@ -57,7 +57,7 @@ Main features - Very few runtime dependencies: webob, simplegeneric (+ Genshi if you use SOAP). - Integration in `Sphinx`_ for making clean documentation with - wsme.sphinxext (work in progress). + ``wsmeext.sphinxext``. .. _Pecan: http://pecanpy.org/ .. _TurboGears: http://www.turbogears.org/ diff --git a/doc/conf.py b/doc/conf.py index daf168c..b972a2a 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -25,7 +25,7 @@ sys.path.insert(0, os.path.abspath('..')) # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'wsme.sphinxext', +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'wsmeext.sphinxext', 'sphinx.ext.intersphinx'] # Add any paths that contain templates here, relative to this directory. diff --git a/doc/document.rst b/doc/document.rst index e962755..79c2240 100644 --- a/doc/document.rst +++ b/doc/document.rst @@ -10,12 +10,12 @@ Install the extension Here we consider that you already quick-started a sphinx project. -#. In your ``conf.py`` file, add ``'wsme.sphinxext'`` to you extensions, +#. In your ``conf.py`` file, add ``'ext'`` to you extensions, and optionally set the enabled protocols. .. code-block:: python - extensions = ['wsme.sphinxext'] + extensions = ['ext'] wsme_protocols = ['restjson', 'restxml', 'extdirect'] @@ -93,7 +93,7 @@ Example * - .. code-block:: rst - .. wsme:root:: wsme.sphinxext.SampleService + .. wsme:root:: wsmeext.sphinxext.SampleService :webpath: /api .. wsme:type:: MyType @@ -106,7 +106,7 @@ Example .. wsme:function:: doit - - .. wsme:root:: wsme.sphinxext.SampleService + - .. wsme:root:: wsmeext.sphinxext.SampleService :webpath: /api .. wsme:type:: MyType @@ -150,7 +150,7 @@ Full Example Python source ~~~~~~~~~~~~~ -.. literalinclude:: ../wsme/sphinxext.py +.. literalinclude:: ../wsmeext/sphinxext.py :lines: 42-67 :language: python @@ -159,27 +159,27 @@ Documentation source .. code-block:: rst - .. default-domain:: wsme + .. default-domain:: wsmeext - .. autotype:: wsme.sphinxext.SampleType + .. autotype:: wsmeext.sphinxext.SampleType :members: - .. autoservice:: wsme.sphinxext.SampleService + .. autoservice:: wsmeext.sphinxext.SampleService :members: Result ~~~~~~ -.. default-domain:: wsme +.. default-domain:: wsmeext .. type:: int An integer -.. autotype:: wsme.sphinxext.SampleType +.. autotype:: wsmeext.sphinxext.SampleType :members: -.. autoservice:: wsme.sphinxext.SampleService +.. autoservice:: wsmeext.sphinxext.SampleService :members: diff --git a/doc/types.rst b/doc/types.rst index 51ef157..fc66f03 100644 --- a/doc/types.rst +++ b/doc/types.rst @@ -81,8 +81,8 @@ or needs to validate data integrity. To define a user type, you just have to inherit from :class:`wsme.types.UserType` and instanciate your new class. This instance -will be your new type and can be used as @:class:`wsme.expose` or -@:class:`wsme.validate` parameters. +will be your new type and can be used as @\ :class:`wsme.expose` or +@\ :class:`wsme.validate` parameters. Note that protocols can choose to specifically handle a user type or a base class of user types. This is case with the two pre-defined diff --git a/wsmeext/sphinxext.py b/wsmeext/sphinxext.py index 898b333..513994d 100644 --- a/wsmeext/sphinxext.py +++ b/wsmeext/sphinxext.py @@ -253,9 +253,9 @@ class TypeDocumenter(autodoc.ClassDocumenter): content.extend(( u' ' * 8 + line for line in sample.split('\n'))) for line in content: - self.add_line(line, u'') + self.add_line(u'', '') if samples_slot == 'after-docstring': add_docstring() @@ -284,9 +284,9 @@ class AttributeDocumenter(autodoc.AttributeDocumenter): def add_content(self, more_content, no_docstring=False): self.add_line( u':type: %s' % datatypename(self.datatype), - '' + '' ) - self.add_line(u'', '') + self.add_line(u'', '') super(AttributeDocumenter, self).add_content( more_content, no_docstring)