Make list of APIs on the index a table.
This commit is contained in:
parent
4b27d6a7a4
commit
5b18db9096
6 changed files with 50 additions and 9 deletions
|
@ -17,14 +17,10 @@ Matrix APIs
|
|||
|
||||
The following APIs are documented in this specification:
|
||||
|
||||
- `Client-Server API <client_server.html>`_ (%CLIENT_RELEASE_LABEL%) Interaction between clients and servers
|
||||
- `Server-Server API <server_server.html>`_ (%SERVER_RELEASE_LABEL%) Federation between servers
|
||||
- `Application Service API <application_service.html>`_ (%CLIENT_RELEASE_LABEL%) Privileged server plugins
|
||||
- `Identity Service API <identity_service.html>`_ (unstable) Mapping of third party IDs with Matrix IDs
|
||||
- `Push Gateway API <push_gateway.html>`_ (unstable) Push notifications for Matrix events
|
||||
{{apis}}
|
||||
|
||||
`Appendices <appendices.html>`_ with supplemental information not specific to
|
||||
of the above APIs is also available.
|
||||
one of the above APIs is also available.
|
||||
|
||||
Specification Version
|
||||
---------------------
|
||||
|
|
|
@ -17,9 +17,14 @@ class Units(object):
|
|||
return val
|
||||
|
||||
|
||||
def __init__(self, debug=False):
|
||||
def __init__(self, debug=False, substitutions=None):
|
||||
self.debug = debug
|
||||
|
||||
if substitutions is None:
|
||||
self.substitutions = {}
|
||||
else:
|
||||
self.substitutions = substitutions
|
||||
|
||||
def log(self, text):
|
||||
if self.debug:
|
||||
func_name = ""
|
||||
|
@ -35,7 +40,10 @@ class Units(object):
|
|||
if not func_name.startswith("load_"):
|
||||
continue
|
||||
unit_key = func_name[len("load_"):]
|
||||
unit_dict[unit_key] = func()
|
||||
if len(inspect.getargs(func.func_code).args) > 1:
|
||||
unit_dict[unit_key] = func(self.substitutions)
|
||||
else:
|
||||
unit_dict[unit_key] = func()
|
||||
self.log("Generated unit '%s' : %s" % (
|
||||
unit_key, json.dumps(unit_dict[unit_key])[:50].replace(
|
||||
"\n",""
|
||||
|
|
|
@ -131,7 +131,10 @@ def main(input_module, files=None, out_dir=None, verbose=False, substitutions={}
|
|||
# which spec section will use it, we just need it there in memory for when
|
||||
# they want it.
|
||||
units = AccessKeyStore(
|
||||
existing_data=in_mod.exports["units"](debug=verbose).get_units()
|
||||
existing_data=in_mod.exports["units"](
|
||||
debug=verbose,
|
||||
substitutions=substitutions,
|
||||
).get_units()
|
||||
)
|
||||
|
||||
# use the units to create RST sections
|
||||
|
|
|
@ -176,3 +176,8 @@ class MatrixSections(Sections):
|
|||
def render_common_state_event_fields(self):
|
||||
return self._render_ce_type("state_event")
|
||||
|
||||
def render_apis(self):
|
||||
template = self.env.get_template("apis.tmpl")
|
||||
apis = self.units.get("apis")
|
||||
return template.render(apis=apis)
|
||||
|
||||
|
|
4
templating/matrix_templates/templates/apis.tmpl
Normal file
4
templating/matrix_templates/templates/apis.tmpl
Normal file
|
@ -0,0 +1,4 @@
|
|||
{% import 'tables.tmpl' as tables -%}
|
||||
|
||||
{{ tables.paramtable(apis.rows, ["API", "Version", "Description"]) }}
|
||||
|
|
@ -536,6 +536,31 @@ class MatrixUnits(Units):
|
|||
event_types[event_type] = table
|
||||
return event_types
|
||||
|
||||
def load_apis(self, substitutions):
|
||||
return {
|
||||
"rows": [{
|
||||
"key": "`Client-Server API <client_server.html>`_",
|
||||
"type": substitutions["%CLIENT_RELEASE_LABEL%"],
|
||||
"desc": "Interaction between clients and servers",
|
||||
}, {
|
||||
"key": "`Server-Server API <server_server.html>`_",
|
||||
"type": substitutions["%SERVER_RELEASE_LABEL%"],
|
||||
"desc": "Federation between servers",
|
||||
}, {
|
||||
"key": "`Application Service API <application_service.html>`_",
|
||||
"type": substitutions["%CLIENT_RELEASE_LABEL%"],
|
||||
"desc": "Privileged server plugins",
|
||||
}, {
|
||||
"key": "`Identity Service API <identity_service.html>`_",
|
||||
"type": "unstable",
|
||||
"desc": "Mapping of third party IDs with Matrix ID",
|
||||
}, {
|
||||
"key": "`Push Gateway API <push_gateway.html>`_",
|
||||
"type": "unstable",
|
||||
"desc": "Push notifications for Matrix events",
|
||||
}]
|
||||
}
|
||||
|
||||
def load_event_examples(self):
|
||||
path = EVENT_EXAMPLES
|
||||
examples = {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue