From 78d829e1ac736468396e9facf4d0c8e1d52cc37d Mon Sep 17 00:00:00 2001 From: Ben Goldsworthy Date: Tue, 23 Jul 2024 09:57:11 +0200 Subject: [PATCH] add stats, make work with new key names, etc. --- assets/css/abstracts/_variables.scss | 4 +- assets/css/base/_typography.scss | 20 ++- assets/css/components/_log-stats.scss | 18 +++ assets/css/main.scss | 1 + layouts/_default/section.html | 14 +- layouts/partials/books/publication-year.html | 7 - layouts/partials/books/rows/authors.html | 34 +++++ layouts/partials/books/rows/publish-date.html | 7 + layouts/partials/books/rows/read-dates.html | 9 ++ layouts/partials/books/rows/title.html | 23 +++ layouts/partials/books/table-body.html | 140 +++++++----------- layouts/partials/cite.html | 29 ++-- layouts/partials/films/table-body.html | 57 +++---- layouts/partials/films/table-header.html | 2 +- layouts/partials/games/table-body.html | 8 +- layouts/partials/series_by_id.html | 22 +++ layouts/partials/stats.html | 26 ++++ layouts/partials/tv/table-body.html | 42 ++++-- 18 files changed, 312 insertions(+), 151 deletions(-) create mode 100644 assets/css/components/_log-stats.scss delete mode 100644 layouts/partials/books/publication-year.html create mode 100644 layouts/partials/books/rows/authors.html create mode 100644 layouts/partials/books/rows/publish-date.html create mode 100644 layouts/partials/books/rows/read-dates.html create mode 100644 layouts/partials/books/rows/title.html create mode 100644 layouts/partials/series_by_id.html create mode 100644 layouts/partials/stats.html diff --git a/assets/css/abstracts/_variables.scss b/assets/css/abstracts/_variables.scss index 6137760..099ab6a 100644 --- a/assets/css/abstracts/_variables.scss +++ b/assets/css/abstracts/_variables.scss @@ -3,8 +3,8 @@ $dark: #020202; $light: #fffff0; // Fonts -$defaultFont: "Palatino Linotype", "Book Antiqua", Palatino, serif; -$codeFont: "Input Mono", "Lucida Console", Monaco, monospace; +$defaultFont: "Domitian", "Palatino Linotype", "Book Antiqua", Palatino, serif; +$codeFont: /*"Input Mono", */"Lucida Console", Monaco, monospace; // Breakpoints $breakpoints: ( diff --git a/assets/css/base/_typography.scss b/assets/css/base/_typography.scss index 11d2331..0218992 100644 --- a/assets/css/base/_typography.scss +++ b/assets/css/base/_typography.scss @@ -216,11 +216,22 @@ cite, } } +table .cite { + font-style: normal; +} + .episode-number, -.authors--addtional, +.authors--additional, +.comments, +.edition, .year--original { font-size: 0.75em; - opacity: 0.8; +} + +.comments, +.edition { + margin-block-start: 0.4em; + margin-block-end: 0; } code, @@ -306,7 +317,12 @@ kbd { * Special Text */ + :where([title]) { text-decoration: underline; text-decoration: underline dotted; + + &:not(a *) { + cursor: help; + } } diff --git a/assets/css/components/_log-stats.scss b/assets/css/components/_log-stats.scss new file mode 100644 index 0000000..3ac9767 --- /dev/null +++ b/assets/css/components/_log-stats.scss @@ -0,0 +1,18 @@ +.log-stats { + text-align: center; + font-size: 1.4em; + + & summary { + cursor: pointer; + } + + & div { + display: flex; + justify-content: center; + + & p { + float: left; + margin-inline-end: 1.2em; + } + } +} diff --git a/assets/css/main.scss b/assets/css/main.scss index 61dedc7..551f189 100644 --- a/assets/css/main.scss +++ b/assets/css/main.scss @@ -57,6 +57,7 @@ @import "components/icons"; @import "components/item-tile"; @import "components/table"; +@import "components/log-stats"; @import "pages/home"; @import "pages/collection"; diff --git a/layouts/_default/section.html b/layouts/_default/section.html index 514b35b..ddac409 100644 --- a/layouts/_default/section.html +++ b/layouts/_default/section.html @@ -9,7 +9,8 @@ {{ define "main-header" }}
- {{ $section := first 1 ( split .File.Dir "/" ) }} + {{- .Scratch.Set "section" ( first 1 ( split .File.Dir "/" ) ) -}} + {{- $section := .Scratch.Get "section" -}} {{ if ( or ( in "books" ( delimit $section "" ) ) ( in "games" ( delimit $section "" ) ) ) }} Current ~ {{ end }} @@ -28,18 +29,27 @@ {{ end }} {{ define "main-body" }} -
+
{{ if .File }} + {{ .Scratch.Set "page" ( index ( split .File.Dir "/" ) 1 ) }} {{ if ( in "current log wishlist" ( .Scratch.Get "page" ) ) }} + {{ if ( eq ( .Scratch.Get "page" ) "current" ) }} {{ .Scratch.Set "listMode" "current" }} + {{ else if ( eq ( .Scratch.Get "page" ) "log" ) }} {{ .Scratch.Set "listMode" "log" }} + {{ else if ( eq ( .Scratch.Get "page" ) "wishlist" ) }} {{ .Scratch.Set "listMode" "wishlist" }} + {{ end }} + + {{ partial "stats" . }} + {{ partial "table" . }} + {{ end }} {{ end }}
diff --git a/layouts/partials/books/publication-year.html b/layouts/partials/books/publication-year.html deleted file mode 100644 index 738d965..0000000 --- a/layouts/partials/books/publication-year.html +++ /dev/null @@ -1,7 +0,0 @@ -

{{- index . "Year Published" -}} -{{- if ( index . "Original Publication Year" ) -}} - {{- if ( ne ( index . "Original Publication Year" ) ( index . "Year Published" ) ) -}} -  (orig. {{ index . "Original Publication Year" }}) - {{- end -}} -{{- end -}} -

diff --git a/layouts/partials/books/rows/authors.html b/layouts/partials/books/rows/authors.html new file mode 100644 index 0000000..cd33201 --- /dev/null +++ b/layouts/partials/books/rows/authors.html @@ -0,0 +1,34 @@ +{{- with .Author -}} +

{{ . }}

+{{- else -}} + {{- $authors_names := slice -}} + + {{- range .authors -}} + {{- $authors_names = $authors_names | append .name -}} + {{- end -}} + {{- range .work.authors -}} + {{- $authors_names = $authors_names | append .name -}} + {{- end -}} + {{- if .contributors -}} + {{- range ( where .contributors "role" "like" `[aA]uthor` ) -}} + {{- $authors_names = $authors_names | append .name -}} + {{- end -}} + {{- end -}} +

{{ delimit ( uniq $authors_names ) ", " }}

+{{- end -}} + +{{- if .contributors -}} + {{- $translators_names := slice -}} + + {{- range ( where .contributors "role" "like" `[tT]ranslat` ) -}} + {{- $translators_names = $translators_names | append .name -}} + {{- end -}} + + {{- with $translators_names -}} +

Translator(s): {{ delimit ( uniq . ) ", " }}

+ {{- end -}} +{{- end -}} + +{{- with ( index . "Additional Authors" ) -}} +

Additional Author(s): {{ . }}

+{{- end -}} diff --git a/layouts/partials/books/rows/publish-date.html b/layouts/partials/books/rows/publish-date.html new file mode 100644 index 0000000..e11e043 --- /dev/null +++ b/layouts/partials/books/rows/publish-date.html @@ -0,0 +1,7 @@ +

{{- .publish_date -}} +{{- if .first_publish_date -}} + {{- if ( ne .first_publish_date .publish_date ) -}} +  (orig. {{ .first_publish_date }}) + {{- end -}} +{{- end -}} +

diff --git a/layouts/partials/books/rows/read-dates.html b/layouts/partials/books/rows/read-dates.html new file mode 100644 index 0000000..0dffc7c --- /dev/null +++ b/layouts/partials/books/rows/read-dates.html @@ -0,0 +1,9 @@ +{{- with .date_started -}} + {{- time.Format "Jan 2, 2006" . -}} +{{- else -}} + Unknown +{{- end -}}–{{- with .date_finished -}} + {{- time.Format "Jan 2, 2006" . -}} +{{- else -}} + Unknown +{{- end -}} diff --git a/layouts/partials/books/rows/title.html b/layouts/partials/books/rows/title.html new file mode 100644 index 0000000..e0c227e --- /dev/null +++ b/layouts/partials/books/rows/title.html @@ -0,0 +1,23 @@ +{{- + $cite_options := ( dict + "c" .c + "g" .g + "section" "books" + "schemaType" "Book" + "title" ( cond ( isset .c "subtitle" ) ( + printf "%s: %s" .c.title .c.subtitle + ) ( + .c.title + ) + ) + "edition" ( + default .c.edition_name .c.Edition + ) + ) +-}} + +{{- if .c.work.original_language -}} + {{- $cite_options = merge $cite_options ( dict "titleLang" .c.work.original_language "titleTrans" .c.work.title ) -}} +{{- end -}} + +{{- partial "cite" $cite_options -}} diff --git a/layouts/partials/books/table-body.html b/layouts/partials/books/table-body.html index 1fa4cd2..39d52e4 100644 --- a/layouts/partials/books/table-body.html +++ b/layouts/partials/books/table-body.html @@ -1,23 +1,26 @@ {{ if ( eq ( .Scratch.Get "listMode" ) "current" ) }} - {{ range ( sort $.Site.Data.books.current "Date Started" "desc" ) }} + {{ range ( sort $.Site.Data.books.current "date_started" "desc" ) }} - {{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }} + {{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ else }}n/a{{ end }} + - {{- partial "cite" ( dict "c" . "schemaType" "Book" ) -}} - - -

{{ .Author }}

- {{- if ( index . "Additional Authors" ) -}} -

Additional: {{ index . "Additional Authors" }}

+ {{- partial "books/rows/title.html" ( dict "c" . "g" $ ) -}} + + {{- with .comments -}} +

Comments: {{ . }}

{{- end -}} + - {{- partial "books/publication-year.html" . -}} + {{- partial "books/rows/authors.html" . -}} + - {{- if index . "Date Started" -}} - {{- time.Format "Jan 2, 2006" ( index . "Date Started" ) -}} - {{- end -}}– + {{- partial "books/rows/publish-date.html" . -}} + + + + {{- partial "books/rows/read-dates.html" . -}} {{ end }} @@ -27,39 +30,26 @@ {{ range ( sort ( where $.Site.Data.books.log "Date Finished" "!=" "" ) "Date Finished" "desc" ) }} - {{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }} + {{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ else }}n/a{{ end }} + -

- {{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}} - {{ range . }} - - {{ end }} - {{- end -}} - {{ .Title }}{{ if .Edition }} ({{ .Edition }}){{ end }} - {{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}} - - {{- end -}} -

- - -

{{ .Author }}

- {{- if ( index . "Additional Authors" ) -}} -

Additional: {{ index . "Additional Authors" }}

+ {{- partial "books/rows/title.html" ( dict "c" . "g" $ ) -}} + + {{- with .comments -}} +

Comments: {{ . }}

{{- end -}} + - {{- partial "books/publication-year.html" . -}} + {{- partial "books/rows/authors.html" . -}} + - {{- if index . "Date Started" -}} - {{- time.Format "Jan 2, 2006" ( index . "Date Started" ) -}} - {{- else -}} - Unknown - {{- end -}}–{{- if index . "Date Finished" -}} - {{- time.Format "Jan 2, 2006" ( index . "Date Finished" ) -}} - {{- else -}} - Unknown - {{- end -}} + {{- partial "books/rows/publish-date.html" . -}} + + + + {{- partial "books/rows/read-dates.html" . -}} {{ end }} @@ -68,68 +58,50 @@ {{ range ( sort ( where $.Site.Data.books.log "Date Finished" "" ) "Title" "asc" ) }} - {{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }} + {{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ else }}n/a{{ end }} + -

- {{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}} - {{ range . }} - - {{ end }} - {{- end -}} - {{ .Title }}{{ if .Edition }} ({{ .Edition }}){{ end }} - {{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}} - - {{- end -}} -

- - -

{{ .Author }}

- {{- if ( index . "Additional Authors" ) -}} -

Additional: {{ index . "Additional Authors" }}

+ {{- partial "books/rows/title.html" ( dict "c" . "g" $ ) -}} + + {{- with .comments -}} +

Comments: {{ . }}

{{- end -}} + - {{- partial "books/publication-year.html" . -}} + {{- partial "books/rows/authors.html" . -}} + - {{- if index . "Date Started" -}} - {{- time.Format "Jan 2, 2006" ( index . "Date Started" ) -}} - {{- else -}} - Unknown - {{- end -}}–{{- if index . "Date Finished" -}} - {{- time.Format "Jan 2, 2006" ( index . "Date Finished" ) -}} - {{- else -}} - Unknown - {{- end -}} + {{- partial "books/rows/publish-date.html" . -}} + + + + {{- partial "books/rows/read-dates.html" . -}} {{ end }} {{ else if ( eq ( .Scratch.Get "listMode" ) "wishlist" ) }} {{ range ( sort $.Site.Data.books.wishlist "Title" "asc" ) }} - {{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }} + {{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ else }}n/a{{ end }} + -

- {{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}} - {{ range . }} - - {{ end }} - {{- end -}} - {{ .Title }}{{ if .Edition }} ({{ .Edition }}){{ end }} - {{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}} - - {{- end -}} -

- - -

{{ .Author }}

- {{- if ( index . "Additional Authors" ) -}} -

Additional: {{ index . "Additional Authors" }}

+ {{- partial "books/rows/title.html" ( dict "c" . "g" $ ) -}} + + {{- with .comments -}} +

Comments: {{ . }}

{{- end -}} + - {{- partial "books/publication-year.html" . -}} + {{- partial "books/rows/authors.html" . -}} + + + {{- partial "books/rows/publish-date.html" . -}} + + n/a {{ end }} diff --git a/layouts/partials/cite.html b/layouts/partials/cite.html index 37563e0..f511f42 100644 --- a/layouts/partials/cite.html +++ b/layouts/partials/cite.html @@ -1,16 +1,21 @@ {{- $itemType := default "CreativeWork" .schemaType -}} +{{- $pages := where ( where .g.Site.Pages "Section" .section ) "title" .title | first 1 -}} + {{- with .c -}} - - {{- default .Title $.title -}} - -{{- if .Edition }} ({{ .Edition }}){{- end -}} + {{- with $pages -}}{{- range . -}}{{- end -}}{{- end -}} + + {{- default .Title $.title -}} + + {{- with $pages -}}{{- end -}} + + {{- with $.edition }}

{{ . }}

{{- end -}} {{- end -}} diff --git a/layouts/partials/films/table-body.html b/layouts/partials/films/table-body.html index 615d73e..963e938 100644 --- a/layouts/partials/films/table-body.html +++ b/layouts/partials/films/table-body.html @@ -2,16 +2,23 @@

Diary

- {{ range ( sort ( where $.Site.Data.films.log "date_completed" "!=" "" ) "date_completed" "desc" ) }} + {{ range ( sort ( where $.Site.Data.films.log "date_finished" "!=" "" ) "date_finished" "desc" ) }} {{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }} + - {{ .title }} + {{- partial "cite" ( dict "c" . "g" $ "section" "films" "schemaType" "Movie" "title" .title "titleLang" .original_language "titleTrans" .original_title ) -}} + + {{- with .comments -}} +

Comments: {{ . }}

+ {{- end -}} + {{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }} + - {{- if .date_completed -}} - {{- time.Format "Jan 2, 2006" .date_completed -}} + {{- if .date_finished -}} + {{- time.Format "Jan 2, 2006" .date_finished -}} {{- if .is_repeat }} ↻{{ end -}} {{- else -}} n/a @@ -22,24 +29,23 @@

Assorted

- {{ range ( sort ( where $.Site.Data.films.log "date_completed" "" ) "title" "asc" ) }} + {{ range ( sort ( where $.Site.Data.films.log "date_finished" "" ) "title" "asc" ) }} {{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }} + - {{- with ( where ( where $.Site.Pages "Section" "films" ) "title" .title ) -}} - {{ range . }} - - {{ end }} - {{- end -}} - {{ .title }} - {{- with ( where ( where $.Site.Pages "Section" "films" ) "title" .title ) -}} - - {{- end -}} + {{- partial "cite" ( dict "c" . "g" $ "section" "films" "schemaType" "Movie" "title" .title "titleLang" .original_language "titleTrans" .original_title ) -}} + + {{- with .comments -}} +

Comments: {{ . }}

+ {{- end -}} + {{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }} + - {{- if .date_completed -}} - {{- time.Format "Jan 2, 2006" .date_completed -}} + {{- if .date_finished -}} + {{- time.Format "Jan 2, 2006" .date_finished -}} {{- if .is_repeat }} ↻{{ end -}} {{- else -}} n/a @@ -51,21 +57,20 @@ {{ range ( sort $.Site.Data.films.wishlist "title" "asc" ) }} {{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }} + - {{- with ( where ( where $.Site.Pages "Section" "films" ) "title" .title ) -}} - {{ range . }} - - {{ end }} - {{- end -}} - {{ .title }} - {{- with ( where ( where $.Site.Pages "Section" "films" ) "title" .title ) -}} - + {{- partial "cite" ( dict "c" . "g" $ "section" "films" "schemaType" "Movie" "title" .title "titleLang" .original_language "titleTrans" .original_title ) -}} + + {{- with .comments -}} +

Comments: {{ . }}

{{- end -}} + {{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }} + - {{- if .date_completed -}} - {{- time.Format "Jan 2, 2006" .date_completed -}} + {{- if .date_finished -}} + {{- time.Format "Jan 2, 2006" .date_finished -}} {{- if .is_repeat }} ↻{{ end -}} {{- else -}} n/a diff --git a/layouts/partials/films/table-header.html b/layouts/partials/films/table-header.html index 6f769b1..dd6b0e9 100644 --- a/layouts/partials/films/table-header.html +++ b/layouts/partials/films/table-header.html @@ -1,4 +1,4 @@ Date Added Title -Release Year +Release Date Date Watched diff --git a/layouts/partials/games/table-body.html b/layouts/partials/games/table-body.html index 821d0b8..e166055 100644 --- a/layouts/partials/games/table-body.html +++ b/layouts/partials/games/table-body.html @@ -2,7 +2,7 @@ {{ range ( sort $.Site.Data.games.current "Date Started" "desc" ) }} - {{- partial "cite" ( dict "c" . "schemaType" "VideoGame" ) -}} + {{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" ) -}} {{ index . "Date Released" }} {{ .Platforms }} @@ -22,7 +22,7 @@ {{ range ( sort ( where $.Site.Data.games.log "Date Finished" "!=" "" ) "Date Finished" "desc" ) }} - {{- partial "cite" ( dict "c" . "schemaType" "VideoGame" ) -}} + {{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" ) -}} {{ index . "Date Released" }} {{ .Platforms }} @@ -46,7 +46,7 @@ {{ range ( sort ( where $.Site.Data.games.log "Date Finished" "" ) "Title" "asc" ) }} - {{- partial "cite" ( dict "c" . "schemaType" "VideoGame" ) -}} + {{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" ) -}} {{ index . "Date Released" }} {{ .Platforms }} @@ -68,7 +68,7 @@ {{ range ( sort $.Site.Data.games.wishlist "Title" "asc" ) }} - {{- partial "cite" ( dict "c" . "schemaType" "VideoGame" ) -}} + {{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" ) -}} {{ index . "Date Released" }} {{ .Platforms }} diff --git a/layouts/partials/series_by_id.html b/layouts/partials/series_by_id.html new file mode 100644 index 0000000..ca9d7ad --- /dev/null +++ b/layouts/partials/series_by_id.html @@ -0,0 +1,22 @@ +{{- $series_tmdb_id := .tmdb_id -}} +{{- $series := "" -}} + +{{- range ( index .g.Site.Data.tv_series.current ) -}} + {{- if ( eq .tmdb_id $series_tmdb_id ) -}} + {{- $series = . -}} + {{- end -}} +{{- end -}} + +{{- range ( index .g.Site.Data.tv_series.log ) -}} + {{- if ( eq .tmdb_id $series_tmdb_id ) -}} + {{- $series = . -}} + {{- end -}} +{{- end -}} + +{{- range ( index .g.Site.Data.tv_series.wishlist ) -}} + {{- if ( eq .tmdb_id $series_tmdb_id ) -}} + {{- $series = . -}} + {{- end -}} +{{- end -}} + +{{- return $series -}} diff --git a/layouts/partials/stats.html b/layouts/partials/stats.html new file mode 100644 index 0000000..a6e5e06 --- /dev/null +++ b/layouts/partials/stats.html @@ -0,0 +1,26 @@ +{{- $section := default "" ( .Scratch.Get "section" ) -}} +{{- $list_mode := default "" ( .Scratch.Get "listMode" ) -}} +{{- $log_file := index ( index $.Site.Data $section ) $list_mode -}} + +{{- if $log_file -}} + {{- $total := len $log_file -}} + + {{- $today := time.Now -}} + + {{- $this_year_total := len ( where ( where $log_file "date_finished" "gt" ( ( $today.AddDate -1 0 0 ).Format "2006-01-02" ) ) "date_finished" "lt" "2024-12-31" ) -}} + {{- $this_quarter_total := len ( where ( where $log_file "date_finished" "gt" ( ( $today.AddDate 0 -3 0 ).Format "2006-01-02" ) ) "date_finished" "lt" "2024-09-30" ) -}} + {{- $this_month_total := len ( where ( where $log_file "date_finished" "gt" ( ( $today.AddDate 0 -1 0 ).Format "2006-01-02" ) ) "date_finished" "lt" "2024-07-31" ) -}} + +
+ Summary + +
+

Total: {{ $total }}

+ {{- if eq $list_mode "log" -}} +

Last 12 months: {{ $this_year_total }}

+

Last 3 months: {{ $this_quarter_total }}

+

Last month: {{ $this_month_total }}

+ {{- end -}} +
+
+{{- end -}} diff --git a/layouts/partials/tv/table-body.html b/layouts/partials/tv/table-body.html index 216a007..335e3f0 100644 --- a/layouts/partials/tv/table-body.html +++ b/layouts/partials/tv/table-body.html @@ -1,25 +1,45 @@ {{ if ( eq ( .Scratch.Get "listMode" ) "log" ) }} {{ if ( eq ( .Scratch.Get "listMode" ) "log" ) }} - {{ .Scratch.Set "filterCol" "Date Watched" }} + {{ .Scratch.Set "filterCol" "date_finished" }} {{ .Scratch.Set "filterDir" "desc" }} {{ end }} - {{ range ( sort ( index $.Site.Data.tv ( .Scratch.Get "listMode" ) ) ( .Scratch.Get "filterCol" ) ( .Scratch.Get "filterDir" ) ) }} + {{ range ( sort ( index $.Site.Data.tv_episodes ( .Scratch.Get "listMode" ) ) ( .Scratch.Get "filterCol" ) ( .Scratch.Get "filterDir" ) ) }} - {{- partial "cite" ( dict "c" . "schemaType" "TVSeries" "title" ( index . "Series Title" ) ) -}} + {{- with ( index . "Series Title" ) -}} + {{ . }} + {{- else -}} + {{- $series := partialCached "series_by_id" ( dict "g" $ "tmdb_id" .series.tmdb_id ) .series.tmdb_id -}} + {{- if ( not ( eq $series "" ) ) -}} + {{- partial "cite" ( dict "c" . "g" $ "section" "tv" "schemaType" "TVSeries" "title" $series.name "titleLang" $series.original_language "titleTrans" $series.original_name ) -}} + {{- else -}} + Unknown series + {{- end -}} + {{- end -}} + - {{- partial "cite" ( dict "c" . "schemaType" "TVEpisode" "title" ( index . "Episode Title" ) ) -}} - ({{ index . "Episode Number" }}) + {{- if ( index . "Episode Title" ) -}} + {{- partial "cite" ( dict "c" . "g" $ "section" "tv" "schemaType" "TVEpisode" "title" ( index . "Episode Title" ) ) -}} + ({{ index . "Episode Number" }}) + {{- else -}} + {{- partial "cite" ( dict "c" . "g" $ "section" "tv" "schemaType" "TVEpisode" "title" .name ) -}} + (S{{ .season_number }}E{{ .episode_number }}) + {{- end -}} + - {{- if ( index . "Date Watched" ) -}} - {{- time.Format "Jan 2, 2006" ( index . "Date Watched" ) -}} - {{- if .Rewatch }} ↻{{ end -}} - {{- else -}} - n/a - {{- end -}} + {{- if ( or ( index . "Date Watched" ) .date_finished ) -}} + {{- with ( index . "Date Watched" ) -}} + {{- time.Format "Jan 2, 2006" . -}} + {{- else -}} + {{- time.Format "Jan 2, 2006" .date_finished -}} + {{- end -}} + {{- if ( or .is_rewatch .Rewatch ) }} ↻{{ end -}} + {{- else -}} + n/a + {{- end -}} {{ end }}