GNUnet 0.22.2
flask.py
Go to the documentation of this file.
1"""
2 sphinxcontrib.autohttp.flask
3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
5 The sphinx.ext.autodoc-style HTTP API reference builder (from Flask)
6 for sphinxcontrib.httpdomain.
7
8 :copyright: Copyright 2011 by Hong Minhee
9 :license: BSD, see LICENSE for details.
10
11"""
12from __future__ import absolute_import
13
14import re
15import itertools
16import six
17
18from docutils import nodes
19from docutils.parsers.rst import directives
20from docutils.statemachine import ViewList
21
22from sphinx.util import force_decode
23from sphinx.util.compat import Directive
24from sphinx.util.nodes import nested_parse_with_titles
25from sphinx.util.docstrings import prepare_docstring
26from sphinx.pycode import ModuleAnalyzer
27
28from sphinxcontrib import httpdomain
29from sphinxcontrib.autohttp.common import http_directive, import_object
30
31from .flask_base import AutoflaskBase
32
33class AutoflaskDirective(AutoflaskBase):
34
35 def run(self):
36 node = nodes.section()
37 node.document = self.state.document
38 result = ViewList()
39 for line in self.make_rstmake_rst():
40 result.append(line, '<autoflask>')
41 nested_parse_with_titles(self.state, result, node)
42 return node.children
43
44
45def setup(app):
46 if 'http' not in app.domains:
47 httpdomain.setup(app)
48 app.add_directive('autoflask', AutoflaskDirective)