29 lines
1.9 KiB
Django/Jinja
29 lines
1.9 KiB
Django/Jinja
{% import 'examples_macros.j2' as examples %}
|
|
{% macro type(attribute) %}{%- if attribute.type is mapping %}
|
|
{%- if attribute.type.members[0].value is string %}string{%- endif %}
|
|
{%- if attribute.type.members[0].value is int %}int{%- endif %}
|
|
{%- if attribute.type.members[0].value is float %}double{%- endif %}
|
|
{%- elif attribute.type == "template[boolean]" %}boolean
|
|
{%- elif attribute.type == "template[int]" %}int
|
|
{%- elif attribute.type == "template[double]" %}double
|
|
{%- elif attribute.type == "template[string]" %}string
|
|
{%- elif attribute.type == "template[boolean[]]" %}boolean[]
|
|
{%- elif attribute.type == "template[int[]]" %}int[]
|
|
{%- elif attribute.type == "template[double[]]" %}double[]
|
|
{%- elif attribute.type == "template[string[]]" %}string[]
|
|
{%- else %}{{ attribute.type | trim }}{%- endif %}{% endmacro %}
|
|
|
|
{% macro name(attribute) %}{%- if attribute.type is startingwith("template[") %}`{{ attribute.name }}.<key>`
|
|
{%- else %}`{{ attribute.name }}`{%- endif %}{% endmacro %}
|
|
|
|
{% macro find_lineage(attr_id, lineage) %}{% if attr_id in lineage %}{{lineage[attr_id].source_group}}{% endif %}{% endmacro %}
|
|
|
|
{% macro name_with_link(attribute, attribute_registry_base_url, lineage_attributes) %}[{{name(attribute)}}]({{attribute_registry_base_url}}/{{ find_lineage(attribute.name, lineage_attributes) | split_id | list | reject("eq", "registry")| first | kebab_case }}.md){% endmacro %}
|
|
|
|
{% macro display_name(group) %}
|
|
{%- if 'display_name' in group %}{{ group.display_name }}
|
|
{%- else %}{{ group.id | split_id | list | reject("eq", "registry") | join(" ") | title_case | acronym }} Attributes
|
|
{%- endif %}{% endmacro %}
|
|
|
|
{% macro heading_link_fragments(title) %}{{ title | trim | lower | replace(" ", "-") | replace("(", "") | replace(")", "") | replace("/", "") | replace("\\", "") | replace(".", "") | replace("!", "") | replace("?", "") | replace("~", "") | replace("#", "")}}{% endmacro %}
|