{# A call's estimate on its button (design section 15.4): tokens, and its cost at API prices when known. #} {% macro cost(estimate) -%} {%- if estimate -%} ~{{ estimate.tokens|tokens }} {{ _("tokens") }}{% if estimate.cost_usd is none %}{% elif estimate.cost_usd == 0 %} · {{ _("free") }}{% else %} · ~{{ estimate.cost_usd|dollars }}{% endif %} {%- endif -%} {%- endmacro %} {# A search result's kind, in the reader's language (design section 7.2). #} {% macro kind_name(kind) -%} {%- set names = {"area": _("Area"), "concept": _("Concept"), "path": _("Path"), "digest": _("Digest"), "answer": _("Saved answer"), "decision": _("Decision"), "fact": _("Fact")} -%} {{ names.get(kind, kind) }} {%- endmacro %} {# How each provider is signed in, and the latest plan usage, under an estimate (design section 15.4). #} {% macro account_notes(sign_ins, plan_usage) -%} {%- endmacro %} {# A fact's id as the reader sees it: the repository root's facts (`project:.`, `part:.`, `worker:.`) name the root in words, in the reader's language; every other id, a target's own name ending in ":." among them, is shown as is. #} {% macro fact_name(fact_id) -%} {% if fact_id in ("project:.", "part:.", "worker:.") %}{{ fact_id[:-2] }} · {{ _("repository root") }}{% else %}{{ fact_id }}{% endif %} {%- endmacro %} {# A rationale block of guide content (design section 6.4): documented, with its citation and a link to it when there is one, or inferred. Its label is the interface's, in the reader's language; the citation and the content stay English. #} {% macro rationale(segment) -%} {%- endmacro %} {# Guide content as segments: HTML, and rationale blocks with their interface labels. #} {% macro segment_list(segments) -%} {%- for segment in segments -%} {%- if segment.kind == "html" %}{{ segment.html }}{% elif segment.kind == "rationale" %}{{ rationale(segment) }}{% endif -%} {%- endfor -%} {%- endmacro %} {# A team overview's body and the digests it was written from (design section 24.9), in English; the team page gives it a Mark read button, the past catch-ups page doesn't (design section 25.3). That page passes `linked`, the targets the team still follows: a digest's repository outside it is named without a link. #} {% macro team_overview(overview, read_button=True, linked=None) -%}
{{ segment_list(overview.segments) }}

{{ _("From the digests of") }} {% for target, repository, digest_id in overview.digests %}{% if linked is none or target in linked %}{{ repository }}{% else %}{{ repository }}{% endif %}{% if not loop.last %}, {% endif %}{% endfor %}

{% if read_button %}{% endif %}
{%- endmacro %} {# Why a catch-up has no overview (design section 24.9), its reason isolated: it comes from the catch-up's record. #} {% macro team_overview_problem(problem) -%} {% set reason %}{{ problem }}{% endset %}

{{ _("This catch-up has no overview: %(problem)s", problem=reason) }}

{%- endmacro %} {# A digest as a team card shows it (design section 24.7): its title linked to it, its highlights with their marks or its first paragraph, and how many guide pages changed; then a Mark read button, or, without one, an "unread" pill while it is unread (design section 25.3). #} {% macro team_digest(digest, target, read_button=True, unread=False) -%}

{{ digest.title }}

{% if digest.highlights %} {% else %}{{ segment_list(digest.first_paragraph) }}{% endif %}
{% trans count=digest.pages_changed %}{{ count }} guide page changed{% pluralize %}{{ count }} guide pages changed{% endtrans %} {% if read_button %} {%- elif unread %}{{ _("unread") }}{% endif %}
{%- endmacro %}