{# _partials/paper_card.html — Bundle H shared paper card partial. Used by /discovery/{id}, /themes/{id}, /feedback, and future cluster-aware-ask (Bundle I). Required context: paper — dict with keys: doi, title, score, rationale, score_breakdown_json, ingested, [distance_to_centroid (optional, themes only)] loop — Jinja loop variable (for unique element IDs); pass loop.index OR a unique index manually via `card_index`. Optional context flags (all default off/on as noted): show_feedback_buttons bool — controlled by web_ui.show_feedback_buttons config (P4: default True). Gates the Save/Dismiss/👍/👎/Rate row. show_score_decomp bool — show "Why this paper?" panel (default True). show_action_buttons bool — show Relink/Re-extract buttons from P8 (default False, enabled on /discovery/{id} only). feedback_source str — value passed as 'source' in /api/feedback POST (default "discovery"). card_index int — fallback unique index when not inside a Jinja loop. #} {% set _idx = card_index if card_index is defined else loop.index %} {% set _source = feedback_source if feedback_source is defined else "discovery" %}

{% if paper.doi %} {{ paper.title or "Untitled" }} {% else %} {{ paper.title or "Untitled" }} {% endif %}

{% if paper.doi %} {{ paper.doi }} {% else %} (no DOI) {% endif %} · score {{ "%.3f" | format(paper.score or 0 | float) }} {% if paper.ingested %} · ingested {% endif %} {% if paper.distance_to_centroid is defined and paper.distance_to_centroid is not none %} · dist {{ "%.3f" | format(paper.distance_to_centroid | float) }} {% endif %}

{% if paper.rationale %}

{{ paper.rationale }}

{% endif %} {# Bundle B: collapsible "Why this paper?" panel (default open). #} {% if show_score_decomp | default(true) and paper.score_breakdown_json %} {% include "_partials/score_decomposition.html" %} {% endif %} {# Bundle H: feedback buttons — gated by web_ui.show_feedback_buttons (P4: default true). #} {% if show_feedback_buttons %}
⭐ Rate
{% for r in [1, 2, 3, 4, 5] %} {% endfor %}
{% endif %} {# P8 action buttons (Relink / Re-extract) — enabled on /discovery/{id} only. #} {% if show_action_buttons | default(false) and paper.doi %} {# DOI is embedded literally in the URL path — no urlencode — so that the {doi:path} route (which accepts "10.0/x" verbatim) matches correctly. Double-encoding would produce "%2F" in the request path and break the route. #}
{% endif %}