2 sphinxcontrib.autohttp.flaskqref
3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 The sphinx.ext.autodoc-style HTTP API quick reference
7 for sphinxcontrib.httpdomain.
9 :copyright: Copyright 2011 by Hong Minhee
10 :license: BSD, see LICENSE
for details.
14from docutils import nodes
15from docutils.statemachine import ViewList
17from sphinxcontrib import httpdomain
18from sphinx.util.nodes import nested_parse_with_titles
20from .flask import AutoflaskBase
23class QuickReferenceFlaskDirective(AutoflaskBase):
37 node = nodes.section()
38 node.document = self.state.document
40 for line
in QuickReferenceFlaskDirective.header:
41 result.append(line,
'<qrefflask>')
46 name = table_row[
'name']
47 if table.get(name)
is None:
49 table[name].append(table_row)
50 if name
not in table_sorted_names:
51 table_sorted_names.append(name)
53 table_sorted_names.sort()
55 for name
in table_sorted_names:
59 previous_description=
None
60 for row
in table[name]:
61 result.append(
' * - %s' % display_name,
'<qrefflask>')
63 result.append(row[
'operation'],
'<qrefflask>')
64 description = row[
'description']
65 if previous_description
is not None and previous_description == description:
68 previous_description = description
70 result.append(
' - %s' % description,
'<qrefflask>')
72 result.append(
'',
'<qrefflask>')
73 nested_parse_with_titles(self.state, result, node)
77 if 'http' not in app.domains:
79 app.add_directive(
'qrefflask', QuickReferenceFlaskDirective)
def make_rst(self, qref=False)