Skip to content

Commit

Permalink
Merge pull request #1631 from turt2live/travis/general/unstable-warning
Browse files Browse the repository at this point in the history
 Render a warning if the spec is unstable
  • Loading branch information
turt2live authored Aug 31, 2018
2 parents f72c821 + ab00630 commit f013b7e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripts/templating/matrix_templates/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,13 @@ def render_apis(self):
apis = self.units.get("apis")
return template.render(apis=apis)

def render_unstable_warnings(self):
rendered = {}
blocks = self.units.get("unstable_warnings")
for var, text in blocks.items():
rendered["unstable_warning_block_" + var] = text
return rendered

def render_swagger_definition(self):
rendered = {}
template = self.env.get_template("schema-definition.tmpl")
Expand Down
16 changes: 16 additions & 0 deletions scripts/templating/matrix_templates/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,22 @@ def load_changelogs(self):

return changelogs

def load_unstable_warnings(self, substitutions):
warning = """
.. WARNING::
You are viewing an unstable version of this specification. Unstable
specifications may change at any time without notice. To view the
current specification, please `click here <latest.html>`_.
"""
warnings = {}
for var in substitutions.keys():
key = var[1:-1] # take off the surrounding %-signs
if substitutions.get(var, "unstable") == "unstable":
warnings[key] = warning
else:
warnings[key] = ""
return warnings


def load_spec_targets(self):
with open(TARGETS, "r") as f:
Expand Down
2 changes: 2 additions & 0 deletions specification/application_service_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
Application Service API
=======================

{{unstable_warning_block_APPSERVICE_RELEASE_LABEL}}

The Matrix client-server API and server-server APIs provide the means to
implement a consistent self-contained federated messaging fabric. However, they
provide limited means of implementing custom server-side behaviour in Matrix
Expand Down
2 changes: 2 additions & 0 deletions specification/client_server_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
Client-Server API
=================

{{unstable_warning_block_CLIENT_RELEASE_LABEL}}

The client-server API provides a simple lightweight API to let clients send
messages, control rooms and synchronise conversation history. It is designed to
support both lightweight clients which store no state and lazy-load data from
Expand Down
2 changes: 2 additions & 0 deletions specification/identity_service_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
Identity Service API
====================

{{unstable_warning_block_IDENTITY_RELEASE_LABEL}}

The Matrix client-server and server-server APIs are largely expressed in Matrix
user identifiers. From time to time, it is useful to refer to users by other
("third-party") identifiers, or "3pid"s, e.g. their email address or phone
Expand Down
2 changes: 2 additions & 0 deletions specification/push_gateway.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
Push Gateway API
================

{{unstable_warning_block_PUSH_GATEWAY_RELEASE_LABEL}}

Clients may want to receive push notifications when events are received at
the homeserver. This is managed by a distinct entity called the Push Gateway.

Expand Down

0 comments on commit f013b7e

Please sign in to comment.