You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
10 years ago
|
"""Contains all the sections for the spec."""
|
||
10 years ago
|
from batesian import AccessKeyStore
|
||
|
from batesian.sections import Sections
|
||
10 years ago
|
import inspect
|
||
10 years ago
|
import os
|
||
|
|
||
|
|
||
10 years ago
|
class MatrixSections(Sections):
|
||
10 years ago
|
|
||
|
def render_room_events(self):
|
||
|
template = self.env.get_template("events.tmpl")
|
||
10 years ago
|
examples = self.units.get("event_examples")
|
||
|
schemas = self.units.get("event_schemas")
|
||
10 years ago
|
sections = []
|
||
|
for event_name in sorted(schemas):
|
||
|
if not event_name.startswith("m.room"):
|
||
|
continue
|
||
|
sections.append(template.render(
|
||
|
example=examples[event_name],
|
||
|
event=schemas[event_name]
|
||
|
))
|
||
|
return "\n\n".join(sections)
|
||
10 years ago
|
|
||
10 years ago
|
# pass through git ver so it'll be dropped in the input file
|
||
|
def render_git_version(self):
|
||
10 years ago
|
return self.units.get("git_version")
|
||
10 years ago
|
|
||
10 years ago
|
def _render_ce_type(self, type):
|
||
|
template = self.env.get_template("common-event-fields.tmpl")
|
||
10 years ago
|
ce_types = self.units.get("common_event_fields")
|
||
10 years ago
|
return template.render(common_event=ce_types[type])
|
||
10 years ago
|
|
||
10 years ago
|
def render_common_event_fields(self):
|
||
|
return self._render_ce_type("event")
|
||
|
|
||
|
def render_common_room_event_fields(self):
|
||
|
return self._render_ce_type("room_event")
|
||
|
|
||
|
def render_common_state_event_fields(self):
|
||
|
return self._render_ce_type("state_event")
|