www-from-model/page_templates/publication.md.j2
Michael Hanke 3aa236939a
All checks were successful
Deploy on webserver / Build site and deploy on success (push) Successful in 44s
rf: avoid custom taxonomy_terms macro, use common implementation
2026-05-21 11:52:15 +02:00

55 lines
1.7 KiB
Django/Jinja

{% extends "page.md.j2" %}
{%- set doi = (
__rec.identifiers
| selectattr('schema_type', 'equalto', 'dlthings:DOI')
| list
| first
) if __rec.identifiers is defined and __rec.identifiers is sequence else none -%}
{%- set generation = (
__rec.generated_by
| selectattr('object', 'equalto', 'obo:IAO_0000444')
| list
| first
) if __rec.generated_by is defined and __rec.generated_by is sequence else none -%}
{%- set authors = [] -%}
{%- for auth in __rec.attributed_to -%}
{%- set _ = authors.append({
"pid": auth.object.pid | default(none),
"given_name": auth.object.given_name | default(none),
"family_name": auth.object.family_name | default(none)
}) -%}
{%- endfor -%}
{%- set topics = [] -%}
{%- for top in __rec.about -%}
{%- set _ = topics.append({
"pid": top.pid | default(none),
"display_label": top.display_label | default(none)
}) -%}
{%- endfor -%}
{%- set publication = {
"pid": __rec.pid | default(none),
"doi": doi.notation | default(none) if doi else none,
"date": generation.at_time | default(none) if generation else none,
"title": __rec.title | default(none),
"description": __rec.description | default(none),
"kind": __rec.kind | default(none),
"author": authors | default(none),
"topic": topics | default(none)
} -%}
{% block frontmatter -%}
title: {{ publication.title | toyaml | replace('...\n','') | trim }}
{{ taxonomy_terms('persons', 'xyzri:XYZPerson', attributed_to) -}}
{{ taxonomy_terms('topics', 'xyzri:XYZTopic', about, typeattr='schema_type', pidattr='pid') -}}
{% endblock -%}
{% block frontmatter_params %}
sortkey: "{{ publication.date | default('')}}{{ publication.title | default('') | escape }}"
{{ publication | toyaml | indent(2) | trim }}
{% endblock -%}