www-from-model/page_templates/project.md.j2
Michael Hanke 17bcdd1e15
All checks were successful
Deploy on webserver / Build site and deploy on success (push) Successful in 35s
feat: also consider title as list item text
2026-03-01 20:23:39 +01:00

33 lines
1.4 KiB
Django/Jinja

{% macro taxonomy_terms(taxonomy, type, objects, typeattr='object.schema_type', pidattr='object.pid') -%}
{%- set matching = objects|selectattr(typeattr, 'eq', type)|map(attribute=pidattr)|map('replace', 'xyzrins:' ~ taxonomy ~ '/', '')|sort -%}
{% if matching|length -%}
{{ taxonomy }}:
{% for pid in matching -%}
- {{ pid }}
{% endfor -%}
{%- endif -%}
{%- endmacro -%}
---
title: "{{ title }}"
{{ taxonomy_terms('projects', 'xyzri:XYZProject', parts, typeattr='schema_type', pidattr='pid') -}}
{{ taxonomy_terms('persons', 'xyzri:XYZPerson', associated_with) -}}
{{ taxonomy_terms('instruments', 'xyzri:XYZInstrument', generated, typeattr='schema_type', pidattr='pid') -}}
---
{{ description }}
{% if part_of %}This project is part of{% for p in part_of %} [{{ p.title }}](/{{ p.pid|replace('xyzrins:', '') }}){% endfor %}.{% endif %}
## People
{% for ass in associated_with if ass.object.schema_type == "xyzri:XYZPerson" and not ass.ended -%}
- [{{ ass.object.given_name }} {{ ass.object.family_name }}](/{{ ass.object.pid|replace('xyzrins:', '') }}) ({% for role in ass.roles %}{{ ', ' if not loop.first }}{{ role.display_label|default(role.name) }}{% endfor -%})
{% endfor -%}
{% if generated|length -%}
## Outputs
{% for gen in generated -%}
- [{{ gen.display_label|default(gen.title)|default(gen.name) }}]({{ gen.pid|replace('xyzrins:', '/') }})
{% endfor -%}
{% endif %}