{{ event.detail }}
{% endif %} {% if event.error %}{{ event.error }}
{% elif not event.results and not event.text %}Nothing was found.
{% endif %} {% if event.text %}{{ 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 %}