{# Copyright (C) 2023 CERN. Invenio-app-rdm is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. #} {% macro render_point(coordinates) %} {% if coordinates | length == 2 %} ({{ coordinates[1] }}, {{ coordinates[0] }} ) {% endif %} {% endmacro %} {% macro render_feature(feature) %} {% set place = feature.get("place") %}
{%- if place %} {{ render_feature_with_place(feature) }} {%- else %} {{ render_feature_without_place(feature) }} {%- endif %}
{% endmacro %} {% macro render_feature_with_place(feature) %} {% set geometry = feature.get("geometry", {}) %} {% set place = feature.get("place") %} {% set description = feature.get("description") %}
{{place}} {%- if geometry %} {% set coordinates = geometry.get("coordinates", []) %} {{ render_point(coordinates) }} {%- endif %}
{% if description %} {{description}} {%- endif %}
{%- endmacro %} {% macro render_feature_without_place(feature) %} {% set geometry = feature.get("geometry", {}) %} {% set place = feature.get("place") %} {% set description = feature.get("description") %}
{%- if geometry %} {{ render_point(geometry.get("coordinates", [])) }} {%- else %} {{ _("Unknown") }} {%- endif %}
{% if description %} {{description}} {%- endif %}
{%- endmacro %}