diff options
| author | jacob <jacob@panda> | 2010-06-16 08:37:37 -0500 |
|---|---|---|
| committer | jacob <jacob@panda> | 2010-06-16 08:37:37 -0500 |
| commit | b24d72e1075e526d82d5fcccda356fc66df9d85c (patch) | |
| tree | 8190a7171230d3d79bbdcd84fa455dfd7375bc7a /doc | |
| parent | 0b3da8fdc20936964bdffa08f6a6ec94436b4c41 (diff) | |
| parent | 9e10d8f986614e60c2948b720e89b4ccdbe0f428 (diff) | |
| download | sphinx-b24d72e1075e526d82d5fcccda356fc66df9d85c.tar.gz | |
merge with static
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/web/api.rst | 12 | ||||
| -rw-r--r-- | doc/web/quickstart.rst | 45 | ||||
| -rw-r--r-- | doc/websupport.rst | 4 |
3 files changed, 31 insertions, 30 deletions
diff --git a/doc/web/api.rst b/doc/web/api.rst index 66e89af3..65bf0c58 100644 --- a/doc/web/api.rst +++ b/doc/web/api.rst @@ -7,7 +7,7 @@ Web Support API .. class:: WebSupport The :class:`WebSupport` class provides a central interface for - working with :class:`~sphinx.websupport.document.Document`'s. + working Sphinx documentation. .. method:: init(srcdir='', outdir='') @@ -15,12 +15,4 @@ Web Support API .. method:: get_document(docname) - Retrieve the :class:`~sphinx.websupport.document.Document` object - corresponding to the *docname*. - -.. module:: sphinx.websupport.document -.. class:: Document - - The :class:`Document` provides access to a single document. It - is not instantiated directly, but is returned by methods of the - :class:`~sphinx.websupport.api.WebSupport` object. + Retrieve the context dictionary corresponding to the *docname*. diff --git a/doc/web/quickstart.rst b/doc/web/quickstart.rst index 0a7094bf..94dfb576 100644 --- a/doc/web/quickstart.rst +++ b/doc/web/quickstart.rst @@ -20,13 +20,15 @@ You only need to provide a srcdir if you are building documentation:: support.build() This will create the data the web support package needs and place -it in *outdir*. You can then access -:class:`~sphinx.websupport.document.Document` objects by calling -the get_document(docname) method. For example, to retrieve the "contents" +it in *outdir*. You can then access this data by calling the +get_document(docname) method. For example, to retrieve the "contents" document, do this:: contents_doc = support.get_document('contents') +This will return a dictionary containing the context you need to render +a document. + A more useful example, in the form of a `Flask <http://flask.pocoo.org/>`_ application is:: @@ -42,15 +44,6 @@ application is:: document = support.get_document(docname) return render_template('doc.html', document=document) -This simple application will return a -:class:`~sphinx.websupport.document.Document` object corresponding -to the *docname* variable. This object will have *title* attribute, -as well as a list of HTML "slices". Each slice contains some HTML, -and when joined they form the body of a Sphinx document. Each slice -may or may not be commentable. If a slice is commentable, it will -have an *id* attribute which is used to associate a comment with -part of a document. - In the previous example the doc.html template would look something like this:: @@ -60,13 +53,25 @@ like this:: {{ document.title }} {% endblock %} + {% block extra_js %} + <script type="text/javascript" src="/static/jquery.js"></script> + <script type="text/javascript"> + <!-- + $(document).ready(function() { + $(".spxcmt").append(' <a href="#" class="sphinx_comment"><img src="/static/comment.png" /></a>'); + $("a.sphinx_comment").click(function() { + id = $(this).parent().attr('id'); + alert('[ comment stub ' + id + ' ]'); + return false; + }); + }); + --> + </script> + {% endblock %} + {% block body %} - {% for slice in document.slices -%} - {{ slice.html|safe }} - {% if slice.commentable -%} - <a href="#" onclick="alert('[ comment stub for <{{ slice.id }}> ]'); return false;"> - comment - </a> - {%- endif %} - {%- endfor %} + {{ document.body|safe }} + {% endblock %} + + {% block sidebar %} {% endblock %} diff --git a/doc/websupport.rst b/doc/websupport.rst index a7870460..2927f5a7 100644 --- a/doc/websupport.rst +++ b/doc/websupport.rst @@ -3,6 +3,10 @@ Sphinx Web Support ================== +Sphinx provides a way to easily integrate Sphinx documentation +into your web application. To learn more read the +:ref:`websupportquickstart`. + .. toctree:: web/quickstart |
