{% from 'components/memory-search-evidence.html' import search_evidence %}
{% set entries = data.notes %}
{% if selected_note and selected_note.note_key not in entries|map(attribute='note_key')|list %}{% set entries = [selected_note] + entries %}{% endif %}
{% for item in entries %}
{% set expanded = selected_note and selected_note.note_key == item.note_key %}
{% if expanded and selected_note %}{% set item = selected_note %}{% endif %}
{% if expanded %}{% include 'components/memory-metadata.html' %}{% endif %}
{{ item.text }}
{% if expanded %}{% from 'components/record-references.html' import record_references with context %}{{ record_references(item, item.family) }}{% endif %}
{% else %}
{{ t.notes_no_match if search_query else t.notes_empty }}