Update table ordering and data

This commit is contained in:
Ben Goldsworthy 2023-02-28 22:19:50 -05:00
parent 1d98bd9a56
commit 7a8735994f
3 changed files with 686 additions and 572 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,12 @@
[ [
{
"Date Added": "2023-02-17",
"Title": "Home",
"Release Year": "2018",
"Letterboxd URI": "https://letterboxd.com/film/home-2018-6/",
"Rewatch": true,
"Date Watched": "2023-02-28"
},
{ {
"Date Added": "2023-02-28", "Date Added": "2023-02-28",
"Title": "O, Persecuted", "Title": "O, Persecuted",
@ -18,8 +26,8 @@
{ {
"Date Added": "2023-02-17", "Date Added": "2023-02-17",
"Title": "Home", "Title": "Home",
"Release Year": "", "Release Year": "2018",
"Letterboxd URI": "", "Letterboxd URI": "https://letterboxd.com/film/home-2018-6/",
"Rewatch": false, "Rewatch": false,
"Date Watched": "2023-02-17" "Date Watched": "2023-02-17"
}, },

View file

@ -1,52 +1,158 @@
{{ if ( eq ( .Scratch.Get "listMode" ) "current" ) }} {{ if ( eq ( .Scratch.Get "listMode" ) "current" ) }}
{{ .Scratch.Set "filterCol" "Date Started" }} {{ range ( sort $.Site.Data.books.current "Date Started" "desc" ) }}
{{ .Scratch.Set "filterDir" "asc" }} <tr>
<td>{{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }}</td>
<td>
<p>
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
{{ range . }}
<a href="{{ .RelPermalink }}">
{{ end }}
{{- end -}}
<cite class="book">{{ .Title }}</cite>{{ if .Edition }} <span class="book--edition">({{ .Edition }})</span>{{ end }}
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
</a>
{{- end -}}
</p>
</td>
<td>
<p class="author">{{ .Author }}</p>
{{- if ( index . "Additional Authors" ) -}}
<p class="author--additional">Additional: {{ index . "Additional Authors" }}</p>
{{- end -}}
</td>
<td>
<p class="year">{{- index . "Year Published" -}}
{{- if ( and ( ne ( index . "Original Publication Year" ) "" ) ( ne ( index . "Original Publication Year" ) ( index . "Year Published" ) ) ) -}}
&nbsp;<span class="year--original">(orig.&nbsp;{{ index . "Original Publication Year" }})</span>
{{- end -}}
</td>
<td>
{{- if index . "Date Started" -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Started" ) -}}
{{- end -}}&ndash;
</td>
</tr>
{{ end }}
{{ else if ( eq ( .Scratch.Get "listMode" ) "log" ) }} {{ else if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
{{ .Scratch.Set "filterCol" "Date Finished" }} <tr>
{{ .Scratch.Set "filterDir" "desc" }} <td colspan=5><h3>Diary</h3></td>
</tr>
{{ range ( sort ( where $.Site.Data.books.log "Date Finished" "!=" "" ) "Date Finished" "desc" ) }}
<tr>
<td>{{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }}</td>
<td>
<p>
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
{{ range . }}
<a href="{{ .RelPermalink }}">
{{ end }}
{{- end -}}
<cite class="book">{{ .Title }}</cite>{{ if .Edition }} <span class="book--edition">({{ .Edition }})</span>{{ end }}
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
</a>
{{- end -}}
</p>
</td>
<td>
<p class="author">{{ .Author }}</p>
{{- if ( index . "Additional Authors" ) -}}
<p class="author--additional">Additional: {{ index . "Additional Authors" }}</p>
{{- end -}}
</td>
<td>
<p class="year">{{- index . "Year Published" -}}
{{- if ( and ( ne ( index . "Original Publication Year" ) "" ) ( ne ( index . "Original Publication Year" ) ( index . "Year Published" ) ) ) -}}
&nbsp;<span class="year--original">(orig.&nbsp;{{ index . "Original Publication Year" }})</span>
{{- end -}}
</td>
<td>
{{- if index . "Date Started" -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Started" ) -}}
{{- else -}}
Unknown
{{- end -}}&ndash;{{- if index . "Date Finished" -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Finished" ) -}}
{{- else -}}
Unknown
{{- end -}}
</td>
</tr>
{{ end }}
<tr>
<td colspan=5><h3>Assorted</h3></td>
</tr>
{{ range ( sort ( where $.Site.Data.books.log "Date Finished" "" ) "Title" "asc" ) }}
<tr>
<td>{{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }}</td>
<td>
<p>
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
{{ range . }}
<a href="{{ .RelPermalink }}">
{{ end }}
{{- end -}}
<cite class="book">{{ .Title }}</cite>{{ if .Edition }} <span class="book--edition">({{ .Edition }})</span>{{ end }}
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
</a>
{{- end -}}
</p>
</td>
<td>
<p class="author">{{ .Author }}</p>
{{- if ( index . "Additional Authors" ) -}}
<p class="author--additional">Additional: {{ index . "Additional Authors" }}</p>
{{- end -}}
</td>
<td>
<p class="year">{{- index . "Year Published" -}}
{{- if ( and ( ne ( index . "Original Publication Year" ) "" ) ( ne ( index . "Original Publication Year" ) ( index . "Year Published" ) ) ) -}}
&nbsp;<span class="year--original">(orig.&nbsp;{{ index . "Original Publication Year" }})</span>
{{- end -}}
</td>
<td>
{{- if index . "Date Started" -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Started" ) -}}
{{- else -}}
Unknown
{{- end -}}&ndash;{{- if index . "Date Finished" -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Finished" ) -}}
{{- else -}}
Unknown
{{- end -}}
</td>
</tr>
{{ end }}
{{ else if ( eq ( .Scratch.Get "listMode" ) "wishlist" ) }} {{ else if ( eq ( .Scratch.Get "listMode" ) "wishlist" ) }}
{{ .Scratch.Set "filterCol" "Title" }} {{ range ( sort $.Site.Data.books.wishlist "Title" "asc" ) }}
{{ .Scratch.Set "filterDir" "asc" }} <tr>
{{ end }} <td>{{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }}</td>
<td>
{{ range ( sort ( sort ( index $.Site.Data.books ( .Scratch.Get "listMode" ) ) "Title" "asc" ) ( .Scratch.Get "filterCol" ) ( .Scratch.Get "filterDir" ) ) }} <p>
<tr> {{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
<td>{{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }}</td> {{ range . }}
<td> <a href="{{ .RelPermalink }}">
<p> {{ end }}
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}} {{- end -}}
{{ range . }} <cite class="book">{{ .Title }}</cite>{{ if .Edition }} <span class="book--edition">({{ .Edition }})</span>{{ end }}
<a href="{{ .RelPermalink }}"> {{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
{{ end }} </a>
{{- end -}} {{- end -}}
<cite class="book">{{ .Title }}</cite>{{ if .Edition }} <span class="book--edition">({{ .Edition }})</span>{{ end }} </p>
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}} </td>
</a> <td>
{{- end -}} <p class="author">{{ .Author }}</p>
</p> {{- if ( index . "Additional Authors" ) -}}
</td> <p class="author--additional">Additional: {{ index . "Additional Authors" }}</p>
<td> {{- end -}}
<p class="author">{{ .Author }}</p> </td>
{{- if ( index . "Additional Authors" ) -}} <td>
<p class="author--additional">Additional: {{ index . "Additional Authors" }}</p> <p class="year">{{- index . "Year Published" -}}
{{- end -}} {{- if ( index . "Original Publication Year" ) -}}
</td> <span class="year--original">(orig.&nbsp;{{ index . "Orginal Publication Year" }})</span>
<td> {{- end -}}
<p class="year">{{- index . "Year Published" -}} </td>
{{- if ( index . "Original Publication Year" ) -}} <td>n/a</td>
<span class="year--original">(orig.&nbsp;{{ index . "Orginal Publication Year" }})</span> </tr>
{{- end -}} {{ end }}
</td>
<td>
{{- if index . "Date Started" -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Started" ) -}}
{{- else -}}
Unknown
{{- end -}}&ndash;{{- if index . "Date Finished" -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Finished" ) -}}
{{- else -}}
Unknown
{{- end -}}
</td>
</tr>
{{ end }} {{ end }}