{{ event.detail }}
{% endif %} {% if event.error %}{{ event.error }}
{% elif not event.results and not event.text and not event.image %}Nothing was found.
{% endif %} {% if event.image and event.image.id %} {# What was drawn, in the block that drew it. The picture is also an attachment on this bubble, so the reader sees it without opening anything; this copy is what makes the block make sense on its own once it is expanded, beside the seed and the attempts. The address is built here from an id and is never taken from the event. That is the same rule the result links a few lines down follow, and it matters more here: an event is a dict a runner wrote, and a `src` taken from one would be a model-supplied URL fetched by the reader's browser. `/api/files/{id}/content` is owner-checked on the way out. #}{{ event.text }}
{% endif %}
{% if event.diff %}
{#
What a write or an update changed, in the shape everybody already reads a
change in.
Every line is text off somebody's machine and is escaped exactly like the
rest of this file. The classification reads the first character and never
interprets the rest — a line is coloured, never parsed.
Header lines are checked BEFORE the bare +/- ones, or `+++ b/x.py` renders
as an addition and `--- a/x.py` as a removal at the top of every diff. The
test is against the `a/` and `b/` prefixes rather than against three
dashes, because a removed line whose own text begins with `--` produces
exactly three dashes too.
No whitespace between the spans: they are `display: block` inside a ,
so a newline between two of them is a blank line on screen.
#}
{%- for line in event.diff.split("\n") -%}
{%- if line.startswith('@@') or line.startswith('--- a/')
or line.startswith('+++ b/') or line.startswith('diff ') -%}
{%- set cls = 'meta' -%}
{%- elif line.startswith('+') -%}
{%- set cls = 'add' -%}
{%- elif line.startswith('-') -%}
{%- set cls = 'del' -%}
{%- else -%}
{%- set cls = 'ctx' -%}
{%- endif -%}
{{ line }}
{%- endfor -%}
{% endif %}
{% for result in event.results %}
{% set scheme = (result.url or "").split(":")[0] | lower %}
{% if scheme in ("http", "https") %}
{{ result.title }}
{% else %}
{# Not a link. A result is third-party text and its URL is not trusted to
be safe to click. #}
{{ result.title }}
{% endif %}
{{ result.host }}
{% if result.snippet %}
{{ result.snippet }}
{% endif %}
{% endfor %}