Update docs

This commit is contained in:
Takeshi KOMIYA 2017-04-22 18:52:02 +09:00
parent 56f51cb6aa
commit ca618b2998
4 changed files with 30 additions and 14 deletions

View File

@ -1,6 +1,6 @@
.. _websupportapi: .. _websupportapi:
.. currentmodule:: sphinx.websupport .. currentmodule:: sphinxcontrib.websupport
The WebSupport Class The WebSupport Class
==================== ====================
@ -49,17 +49,24 @@ The WebSupport Class
should be a string specifying that path (e.g. ``'docs'``). should be a string specifying that path (e.g. ``'docs'``).
.. versionchanged:: 1.6
WebSupport class is moved to sphinxcontrib.websupport from sphinx.websupport.
Please add ``sphinxcontrib-websupport`` package in your dependency and use
moved class instead.
Methods Methods
~~~~~~~ ~~~~~~~
.. automethod:: sphinx.websupport.WebSupport.build .. automethod:: sphinxcontrib.websupport.WebSupport.build
.. automethod:: sphinx.websupport.WebSupport.get_document .. automethod:: sphinxcontrib.websupport.WebSupport.get_document
.. automethod:: sphinx.websupport.WebSupport.get_data .. automethod:: sphinxcontrib.websupport.WebSupport.get_data
.. automethod:: sphinx.websupport.WebSupport.add_comment .. automethod:: sphinxcontrib.websupport.WebSupport.add_comment
.. automethod:: sphinx.websupport.WebSupport.process_vote .. automethod:: sphinxcontrib.websupport.WebSupport.process_vote
.. automethod:: sphinx.websupport.WebSupport.get_search_results .. automethod:: sphinxcontrib.websupport.WebSupport.get_search_results

View File

@ -12,7 +12,7 @@ search indices, and node data that is used to track where comments and other
things are in a document. To do this you will need to create an instance of the things are in a document. To do this you will need to create an instance of the
:class:`~.WebSupport` class and call its :meth:`~.WebSupport.build` method:: :class:`~.WebSupport` class and call its :meth:`~.WebSupport.build` method::
from sphinx.websupport import WebSupport from sphinxcontrib.websupport import WebSupport
support = WebSupport(srcdir='/path/to/rst/sources/', support = WebSupport(srcdir='/path/to/rst/sources/',
builddir='/path/to/build/outdir', builddir='/path/to/build/outdir',
@ -39,7 +39,7 @@ Integrating Sphinx Documents Into Your Webapp
Now that the data is built, it's time to do something useful with it. Start off Now that the data is built, it's time to do something useful with it. Start off
by creating a :class:`~.WebSupport` object for your application:: by creating a :class:`~.WebSupport` object for your application::
from sphinx.websupport import WebSupport from sphinxcontrib.websupport import WebSupport
support = WebSupport(datadir='/path/to/the/data', support = WebSupport(datadir='/path/to/the/data',
search='xapian') search='xapian')
@ -115,7 +115,7 @@ The default value for *moderator* is ``False``.
An example `Flask <http://flask.pocoo.org/>`_ function that checks whether a An example `Flask <http://flask.pocoo.org/>`_ function that checks whether a
user is logged in and then retrieves a document is:: user is logged in and then retrieves a document is::
from sphinx.websupport.errors import * from sphinxcontrib.websupport.errors import *
@app.route('/<path:docname>') @app.route('/<path:docname>')
def doc(docname): def doc(docname):
@ -151,7 +151,7 @@ Performing Searches
To use the search form built-in to the Sphinx sidebar, create a function to To use the search form built-in to the Sphinx sidebar, create a function to
handle requests to the url 'search' relative to the documentation root. The handle requests to the url 'search' relative to the documentation root. The
user's search query will be in the GET parameters, with the key `q`. Then use user's search query will be in the GET parameters, with the key `q`. Then use
the :meth:`~sphinx.websupport.WebSupport.get_search_results` method to retrieve the :meth:`~sphinxcontrib.websupport.WebSupport.get_search_results` method to retrieve
search results. In `Flask <http://flask.pocoo.org/>`_ that would be like this:: search results. In `Flask <http://flask.pocoo.org/>`_ that would be like this::
@app.route('/search') @app.route('/search')
@ -191,7 +191,7 @@ request. If the comment is being attached directly to a node, `parent_id`
will be empty. If the comment is a child of another comment, then `node_id` will be empty. If the comment is a child of another comment, then `node_id`
will be empty. Then next function handles the retrieval of comments for a will be empty. Then next function handles the retrieval of comments for a
specific node, and is aptly named specific node, and is aptly named
:meth:`~sphinx.websupport.WebSupport.get_data`:: :meth:`~sphinxcontrib.websupport.WebSupport.get_data`::
@app.route('/docs/get_comments') @app.route('/docs/get_comments')
def get_comments(): def get_comments():

View File

@ -1,6 +1,6 @@
.. _searchadapters: .. _searchadapters:
.. currentmodule:: sphinx.websupport.search .. currentmodule:: sphinxcontrib.websupport.search
Search Adapters Search Adapters
=============== ===============
@ -21,6 +21,10 @@ documentation of the :class:`BaseSearch` class below.
Defines an interface for search adapters. Defines an interface for search adapters.
.. versionchanged:: 1.6
BaseSearch class is moved to sphinxcontrib.websupport.search from
sphinx.websupport.search.
BaseSearch Methods BaseSearch Methods
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~

View File

@ -1,6 +1,6 @@
.. _storagebackends: .. _storagebackends:
.. currentmodule:: sphinx.websupport.storage .. currentmodule:: sphinxcontrib.websupport.storage
Storage Backends Storage Backends
================ ================
@ -21,6 +21,11 @@ documentation of the :class:`StorageBackend` class below.
Defines an interface for storage backends. Defines an interface for storage backends.
.. versionchanged:: 1.6
StorageBackend class is moved to sphinxcontrib.websupport.storage from
sphinx.websupport.storage.
StorageBackend Methods StorageBackend Methods
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~