Add support to build api-ref as plain text

To be able to do that stanzas: "rest_method", "rest_expand_all" and
"http_code" are required for the "text" sphinx node visitor function.

Change-Id: Ib5e298dc0355886d1c373df1b82454390db8487a
This commit is contained in:
Slawek Kaplonski
2025-06-03 16:23:16 +02:00
parent 7a6d5f2251
commit 6084245033
2 changed files with 19 additions and 3 deletions

View File

@@ -26,6 +26,7 @@ import yaml
from os_api_ref.http_codes import http_code
from os_api_ref.http_codes import http_code_html
from os_api_ref.http_codes import http_code_text
from os_api_ref.http_codes import HTTPResponseCodeDirective
__version__ = pbr.version.VersionInfo(
@@ -555,6 +556,14 @@ def rest_expand_all_html(self, node):
raise nodes.SkipNode
def rest_method_text(self, node):
raise nodes.SkipNode
def rest_expand_all_text(self, node):
raise nodes.SkipNode
def create_mv_selector(node):
mv_list = '<option value="" selected="selected">All</option>'
@@ -672,9 +681,12 @@ def setup(app):
# TODO(sdague): if someone wants to support latex/pdf, or man page
# generation using these stanzas, here is where you'd need to
# specify content specific renderers.
app.add_node(rest_method, html=(rest_method_html, None))
app.add_node(rest_expand_all, html=(rest_expand_all_html, None))
app.add_node(http_code, html=(http_code_html, None))
app.add_node(rest_method, html=(rest_method_html, None),
text=(rest_method_text, None))
app.add_node(rest_expand_all, html=(rest_expand_all_html, None),
text=(rest_expand_all_text, None))
app.add_node(http_code, html=(http_code_html, None),
text=(http_code_text, None))
# This specifies all our directives that we're adding
app.add_directive('rest_parameters', RestParametersDirective)

View File

@@ -221,6 +221,10 @@ def http_code_html(self, node):
raise nodes.SkipNode
def http_code_text(self, node):
raise nodes.SkipNode
class http_code(nodes.Part, nodes.Element):
"""Node for http_code stanza