mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-10-01 14:29:08 +02:00
Align client/docs gen with recent changes
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
{{ constants.GPL2_HEADER_SH_LIKE }}
|
||||
{{ constants.GENERATED_HEADER_SH_LIKE }}
|
||||
from enum import IntEnum
|
||||
|
||||
|
||||
# version: 0.0.1
|
||||
class RgblightModes(IntEnum):
|
||||
{%- for id, effect in constants.rgblight.effects | dictsort %}
|
||||
{%- for id, effect in specs.rgblight.effects | dictsort %}
|
||||
{{ effect.key }} = {{ id }}
|
||||
{%- endfor %}
|
||||
|
||||
|
||||
# version: 0.0.1
|
||||
class RgbMatrixModes(IntEnum):
|
||||
{%- for id, effect in constants.rgb_matrix.effects | dictsort %}
|
||||
{%- for id, effect in specs.rgb_matrix.effects | dictsort %}
|
||||
{{ effect.key }} = {{ id }}
|
||||
{%- endfor %}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
{{ constants.GPL2_HEADER_SH_LIKE }}
|
||||
{{ constants.GENERATED_HEADER_SH_LIKE }}
|
||||
class XAPRouteError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
{{ constants.GPL2_HEADER_SH_LIKE }}
|
||||
{{ constants.GENERATED_HEADER_SH_LIKE }}
|
||||
from collections import namedtuple
|
||||
from enum import IntFlag, IntEnum
|
||||
from struct import Struct
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
{{ constants.GPL2_HEADER_XML_LIKE }}
|
||||
{{ constants.GENERATED_HEADER_XML_LIKE }}
|
||||
{%- for item in xap.documentation.order -%}
|
||||
{%- if not item[0:1] == '!' -%}
|
||||
{{ xap.documentation.get(item) }}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
{%- if route.request_type == 'struct' -%}
|
||||
__Request:__
|
||||
{%- for member in route.request_struct_members -%}
|
||||
<br>{{ " "|safe*4 }}* {{ member.name }}: `{{ member.type }}`
|
||||
{%- endfor -%}
|
||||
{%- elif route.request_type -%}
|
||||
__Request:__ `{{ route.request_type }}`
|
||||
{%- endif -%}
|
||||
@@ -1,8 +0,0 @@
|
||||
{%- if route.return_type == 'struct' -%}
|
||||
__Response:__
|
||||
{%- for member in route.return_struct_members -%}
|
||||
<br>{{ " "|safe*4 }}* {{ member.name }}: `{{ member.type }}`
|
||||
{%- endfor -%}
|
||||
{%- elif route.return_type -%}
|
||||
__Response:__ `{{ route.return_type }}`
|
||||
{%- endif -%}
|
||||
@@ -1,3 +1,22 @@
|
||||
{%- macro gen_payload(name, type, members) -%}
|
||||
{%- if type == 'struct' -%}
|
||||
__{{ name }}:__
|
||||
{%- for member in members -%}
|
||||
<br>{{ " "|safe*4 }}* {{ member.name }}: `{{ member.type }}`
|
||||
{%- endfor -%}
|
||||
{%- elif type -%}
|
||||
__{{ name }}:__ `{{ type }}`
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro gen_payloads(route) -%}
|
||||
{{ gen_payload('Request', route.request_type, route.request_struct_members) }}{%- if route.return_type and route.request_type -%}<br><br>{% endif %}{{ gen_payload('Response', route.return_type, route.return_struct_members) }}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro gen_tags(route) -%}
|
||||
{% if 'secure' == route.permissions %}__Secure__{% endif %}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- for id, route in xap.routes | dictsort %}
|
||||
### {{ route.name }} - `{{ id }}`
|
||||
{{ route.description }}
|
||||
@@ -7,9 +26,7 @@
|
||||
| -- | -- | -- | -- | -- |
|
||||
{%- for subid, subroute in route.routes | dictsort %}
|
||||
{%- if not subroute.routes %}
|
||||
{%- with route=subroute %}
|
||||
| {{ subroute.name }} | `{{ id }} {{ subid }}` | {% if 'secure' == subroute.permissions %}__Secure__{% endif %} | {%- include 'route_request.md.j2' -%}{%- if subroute.return_type and subroute.request_type -%}<br><br>{% endif %}{%- include 'route_response.md.j2' -%} | {{ subroute.description.replace('\n', '<br>') }}|
|
||||
{%- endwith %}
|
||||
| {{ subroute.name }} | `{{ id }} {{ subid }}` | {{ gen_tags(subroute) }} | {{ gen_payloads(subroute) }} | {{ subroute.description | newline_to_br }}|
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
||||
@@ -23,9 +40,7 @@
|
||||
| -- | -- | -- | -- | -- |
|
||||
{%- for subsubid, subsubroute in subroute.routes | dictsort %}
|
||||
{%- if not subsubroute.routes %}
|
||||
{%- with route=subsubroute %}
|
||||
| {{ subsubroute.name }} | `{{ id }} {{ subid }} {{ subsubid }}` | {% if 'secure' == subsubroute.permissions %}__Secure__{% endif %} | {%- include 'route_request.md.j2' -%}{%- if subsubroute.return_type and subsubroute.request_type -%}<br><br>{% endif %}{%- include 'route_response.md.j2' -%} | {{ subsubroute.description.replace('\n', '<br>') }}|
|
||||
{%- endwith %}
|
||||
| {{ subsubroute.name }} | `{{ id }} {{ subid }} {{ subsubid }}` | {{ gen_tags(subsubroute) }} | {{ gen_payloads(subsubroute) }} | {{ subsubroute.description | newline_to_br }}|
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{{ constants.GPL2_HEADER_XML_LIKE }}
|
||||
{{ constants.GENERATED_HEADER_XML_LIKE }}
|
||||
|
||||
{%- for ver in versions | reverse -%}
|
||||
* [XAP Version {{ ver }}](xap_{{ ver }}.md)
|
||||
{% endfor %}
|
||||
@@ -1,5 +1,5 @@
|
||||
{{ GPL2_HEADER_C_LIKE }}
|
||||
{{ GENERATED_HEADER_C_LIKE }}
|
||||
{{ constants.GPL2_HEADER_C_LIKE }}
|
||||
{{ constants.GENERATED_HEADER_C_LIKE }}
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{ GPL2_HEADER_C_LIKE }}
|
||||
{{ GENERATED_HEADER_C_LIKE }}
|
||||
{{ constants.GPL2_HEADER_C_LIKE }}
|
||||
{{ constants.GENERATED_HEADER_C_LIKE }}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Full XAP {{ xap.version }} definitions
|
||||
|
||||
Reference in New Issue
Block a user