{{ define "main" }}
  <div class="page">
    <header class="page-header">
      <h1>{{ .Title }}</h1>
    </header>

    {{ with .Content }}<div class="prose">{{ . }}</div>{{ end }}

    {{ $years := slice }}
    {{ range $year, $_ := hugo.Data.termine }}{{ $years = $years | append $year }}{{ end }}
    {{ $years = sort $years "value" "desc" }}
    {{ $current := index $years 0 }}

    {{ range $years }}
      {{ $rows := index hugo.Data.termine . }}
      {{ if eq . $current }}
        <section class="termine-current">
          <h2>Termine {{ . }}</h2>
          {{ partial "termine-table.html" $rows }}
        </section>
      {{ else }}
        <details class="termine-past">
          <summary>Termine {{ . }}</summary>
          {{ partial "termine-table.html" $rows }}
        </details>
      {{ end }}
    {{ end }}
  </div>
{{ end }}
