{{ if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
  <tr>
    <td colspan=4><h3>Diary</h3></td>
  </tr>
  {{ range ( sort ( where $.Site.Data.films.log "date_completed" "!=" "" ) "date_completed" "desc" ) }}
  <tr>
    <td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
    <td>
        {{ .title }}
    </td>
    <td>{{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
    <td>
    {{- if .date_completed -}}
      {{- time.Format "Jan 2, 2006" .date_completed -}}
      {{- if .is_repeat }} &#x21BB;{{ end -}}
    {{- else -}}
      n/a
    {{- end -}}
    </td>
  </tr>  
  {{ end }}
  <tr>
    <td colspan=4><h3>Assorted</h3></td>
  </tr>
  {{ range ( sort ( where $.Site.Data.films.log "date_completed" "" ) "title" "asc" ) }}
  <tr>
    <td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
    <td>
    {{- with ( where ( where $.Site.Pages "Section" "films" ) "title" .title ) -}}
      {{ range . }}
      <a href="{{ .RelPermalink }}">
      {{ end }}
    {{- end -}}
        <cite class="film">{{ .title }}</cite>
    {{- with ( where ( where $.Site.Pages "Section" "films" ) "title" .title ) -}}
      </a>
    {{- end -}}
    </td>
    <td>{{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
    <td>
    {{- if .date_completed -}}
      {{- time.Format "Jan 2, 2006" .date_completed -}}
      {{- if .is_repeat }} &#x21BB;{{ end -}}
    {{- else -}}
      n/a
    {{- end -}}
    </td>
  </tr>  
  {{ end }}
{{ else if ( eq ( .Scratch.Get "listMode" ) "wishlist" ) }}
  {{ range ( sort $.Site.Data.films.wishlist "title" "asc" ) }}
  <tr>
    <td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
    <td>
      {{- with ( where ( where $.Site.Pages "Section" "films" ) "title" .title ) -}}
      {{ range . }}
      <a href="{{ .RelPermalink }}">
        {{ end }}
      {{- end -}}
      <cite class="film">{{ .title }}</cite>
      {{- with ( where ( where $.Site.Pages "Section" "films" ) "title" .title ) -}}
      </a>
      {{- end -}}
    </td>
    <td>{{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
    <td>
    {{- if .date_completed -}}
      {{- time.Format "Jan 2, 2006" .date_completed -}}
      {{- if .is_repeat }} &#x21BB;{{ end -}}
    {{- else -}}
      n/a
    {{- end -}}
    </td>
  </tr>  
  {{ end }}
{{ end }}
