GNUnet  0.19.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 """
12 from __future__ import absolute_import
13 
14 import re
15 import itertools
16 import six
17 
18 from docutils import nodes
19 from docutils.parsers.rst import directives
20 from docutils.statemachine import ViewList
21 
22 from sphinx.util import force_decode
23 from sphinx.util.compat import Directive
24 from sphinx.util.nodes import nested_parse_with_titles
25 from sphinx.util.docstrings import prepare_docstring
26 from sphinx.pycode import ModuleAnalyzer
27 
28 from sphinxcontrib import httpdomain
29 from sphinxcontrib.autohttp.common import http_directive, import_object
30 
31 from .flask_base import AutoflaskBase
32 
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 
45 def setup(app):
46  if 'http' not in app.domains:
47  httpdomain.setup(app)
48  app.add_directive('autoflask', AutoflaskDirective)