-
Notifications
You must be signed in to change notification settings - Fork 211
/
Copy pathattribute_namespace.md.j2
51 lines (47 loc) · 2.23 KB
/
attribute_namespace.md.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{#- This template is rendered per top-level registry namespace. -#}
{#- It consists of two variables: -#}
{#- - id: The top-level namespace id. -#}
{#- - groups: A sequence of all attribute groups under this namespace. -#}
{#- This includes deprecated groups. -#}
{%- import 'stability.j2' as stability -%}
{%- import 'notes.j2' as notes -%}
{%- import 'enum_macros.j2' as enums -%}
{%- import 'attribute_macros.j2' as attrs -%}
{%- import 'examples_macros.j2' as examples -%}
{%- set my_file_name = ctx.id | lower | kebab_case ~ ".md" -%}
{{- template.set_file_name(my_file_name) -}}
{%- set groups = namespace(deprecated=[], non_deprecated=[]) -%}
{%- for group in ctx.groups | sort(attribute="id") -%}
{%- if group.id[-10:] == "deprecated" -%}
{%- set groups.deprecated = groups.deprecated + [group] -%}
{%- else -%}
{%- set groups.non_deprecated = groups.non_deprecated + [group] -%}
{%- endif -%}
{%- endfor -%}
{%- set attr_groups = groups.non_deprecated + groups.deprecated -%}
<!-- NOTE: THIS FILE IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/attribute_namespace.md.j2 -->
# {{ attrs.humanize(attrs.sentence_case(ctx.id)) | acronym }}
{%- if attr_groups | length > 1 %}
{% for group in attr_groups %}
- [{{ attrs.display_name(group) }}](#{{ attrs.heading_link_fragments(attrs.display_name(group)) }})
{%- endfor -%}
{%- endif %}
{% for group in attr_groups %}
## {{ attrs.display_name(group) }}
{% if group.brief.endswith("\n") -%}
{{ group.brief }}
{% else -%}
{{ group.brief }}
{{"\n"}}
{%- endif -%}
| Attribute | Type | Description | Examples | Stability |
|---|---|---|---|---|
{%- for attribute in group.attributes | sort(attribute="name") %}{% set attr_anchor = attribute.name | kebab_case %}
| <a id="{{ attr_anchor }}" href="#{{ attr_anchor }}">{{ attrs.name(attribute) }}</a> | {{ attrs.type(attribute) }} | {{ attribute.brief | trim }}{{ notes.add({"note": attribute.note, "name": attribute.name}) }} | {{ examples.format(attribute) | trim }} | {{ stability.badge(attribute.stability, attribute.deprecated) | trim }} |
{%- endfor %}
{{ notes.render() }}
{%- for enum in group.attributes | sort(attribute="name") %}
{%- if enum.type is mapping -%}{{ enums.table(enum, notes) }}{% endif %}
{%- endfor -%}
{%- endfor -%}