{% extends "base.html" %}
{% block title %}Search · tit{% endblock %}
{% block content %}
  <h1 id="search-heading">Search repositories</h1>
  <section class="search-panel" aria-labelledby="search-heading">
    <form method="get" action="/search">
      <div class="field">
        <label for="metadata-query">Search text</label>
        <input id="metadata-query" name="q" value="{{ query }}" maxlength="256" required>
      </div>
      <button type="submit">Search</button>
    </form>
  </section>
{% if searched %}
  <section aria-labelledby="search-results-heading">
    <h2 id="search-results-heading">Results</h2>
  <p>Scanned {{ rows_scanned }} repository names.</p>
{% if truncated %}
  <p>The result is incomplete because the search reached a limit.</p>
{% endif %}
{% if results.is_empty() %}
  <p>No repository matched the search text.</p>
{% else %}
  <ol class="search-results">
{% for result in results %}
    <li data-result-id="{{ result.stable_id }}">
      <span>{{ result.kind }}</span>
      <a href="{{ result.url }}">{{ result.title }}</a>
{% if !result.summary.is_empty() %}
      <p>{{ result.summary }}</p>
{% endif %}
    </li>
{% endfor %}
  </ol>
{% endif %}
  </section>
{% endif %}
{% endblock %}
