Show multiple examples where present
This commit is contained in:
parent
b92a0f2b4d
commit
176f919fc8
4 changed files with 53 additions and 5 deletions
41
event-schemas/examples/v1/m.room.member#third_party_invite
Normal file
41
event-schemas/examples/v1/m.room.member#third_party_invite
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"age": 242352,
|
||||
"content": {
|
||||
"membership": "join",
|
||||
"avatar_url": "mxc://localhost/SEsfnsuifSDFSSEF#auto",
|
||||
"displayname": "Alice Margatroid",
|
||||
"third_party_invite": {
|
||||
"signed": {
|
||||
"mxid": "@alice:localhost",
|
||||
"signatures": {
|
||||
"magic.forest": {
|
||||
"ed25519:3": "fQpGIW1Snz+pwLZu6sTy2aHy/DYWWTspTJRPyNp0PKkymfIsNffysMl6ObMMFdIJhk6g6pwlIqZ54rxo8SLmAg"
|
||||
}
|
||||
},
|
||||
"token": "abc123"
|
||||
}
|
||||
}
|
||||
},
|
||||
"invite_room_state": [
|
||||
{
|
||||
"type": "m.room.name",
|
||||
"state_key": "",
|
||||
"content": {
|
||||
"name": "Forest of Magic"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "m.room.join_rules",
|
||||
"state_key": "",
|
||||
"content": {
|
||||
"join_rules": "invite"
|
||||
}
|
||||
}
|
||||
],
|
||||
"state_key": "@alice:localhost",
|
||||
"origin_server_ts": 1431961217939,
|
||||
"event_id": "$WLGTSEFSEF:localhost",
|
||||
"type": "m.room.member",
|
||||
"room_id": "!Cuyf34gef24t:localhost",
|
||||
"user_id": "@example:localhost"
|
||||
}
|
|
@ -35,7 +35,7 @@ class MatrixSections(Sections):
|
|||
if not filterFn(event_name):
|
||||
continue
|
||||
sections.append(template.render(
|
||||
example=examples[event_name],
|
||||
examples=examples[event_name],
|
||||
event=schemas[event_name],
|
||||
title_kind=subtitle_title_char
|
||||
))
|
||||
|
|
|
@ -21,8 +21,10 @@
|
|||
======================= ================= ===========================================
|
||||
|
||||
{% endfor %}
|
||||
Example:
|
||||
Example{% if examples | length > 1 %}s{% endif %}:
|
||||
|
||||
{% for example in examples %}
|
||||
.. code:: json
|
||||
|
||||
{{example | jsonify(4, 4)}}
|
||||
{% endfor %}
|
||||
|
|
|
@ -495,9 +495,14 @@ class MatrixUnits(Units):
|
|||
if not filename.startswith("m."):
|
||||
continue
|
||||
with open(os.path.join(path, filename), "r") as f:
|
||||
examples[filename] = json.loads(f.read())
|
||||
if filename == "m.room.message#m.text":
|
||||
examples["m.room.message"] = examples[filename]
|
||||
event_name = filename.split("#")[0]
|
||||
example = json.loads(f.read())
|
||||
|
||||
examples[filename] = examples.get(event_name, [])
|
||||
examples[filename].append(example)
|
||||
if filename != event_name:
|
||||
examples[event_name] = examples.get(event_name, [])
|
||||
examples[event_name].append(example)
|
||||
return examples
|
||||
|
||||
def load_event_schemas(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue