From 3374a5ea2a088fbbabd190a6a59f91452181afed Mon Sep 17 00:00:00 2001 From: Ben Goldsworthy Date: Sun, 23 Feb 2025 01:27:07 +0100 Subject: [PATCH] fix: citations, TV views --- layouts/partials/books/rows/read-dates.html | 11 ++-- layouts/partials/cite.html | 4 +- layouts/partials/series_by_id.html | 22 ++++--- layouts/partials/tv/episodes/table-body.html | 67 +++++++++++--------- layouts/partials/tv/series/table-body.html | 8 +-- 5 files changed, 61 insertions(+), 51 deletions(-) diff --git a/layouts/partials/books/rows/read-dates.html b/layouts/partials/books/rows/read-dates.html index ed871da..1e27b53 100644 --- a/layouts/partials/books/rows/read-dates.html +++ b/layouts/partials/books/rows/read-dates.html @@ -1,11 +1,10 @@ {{- with .date_started -}} - {{- time.Format "Jan 2, 2006" . -}} + {{ if not $.date_finished }}Since{{ end }} + {{ time.Format "Jan 2, 2006" . -}} {{- else -}} Unknown {{- end }} -to
-{{ with .date_finished -}} - {{- time.Format "Jan 2, 2006" . -}} -{{- else -}} - Unknown +{{- with .date_finished }} + to + {{ time.Format "Jan 2, 2006" . -}} {{- end -}} diff --git a/layouts/partials/cite.html b/layouts/partials/cite.html index 2d15d06..8fe8c33 100644 --- a/layouts/partials/cite.html +++ b/layouts/partials/cite.html @@ -9,11 +9,11 @@ itemscope itemprop="citation" itemtype="https://schema.org/{{- $itemType -}}" - {{- if .titleTrans -}} + {{- if $.titleTrans -}} lang="{{- $.titleLang -}}" title="{{- $.titleTrans -}}" {{- end -}}> - {{- .title -}} + {{- $.title -}} {{- with $pages -}}{{- end -}} diff --git a/layouts/partials/series_by_id.html b/layouts/partials/series_by_id.html index ca9d7ad..c4f1148 100644 --- a/layouts/partials/series_by_id.html +++ b/layouts/partials/series_by_id.html @@ -1,22 +1,26 @@ {{- $series_tmdb_id := .tmdb_id -}} {{- $series := "" -}} +{{ warnf "%v" $series_tmdb_id }} {{- range ( index .g.Site.Data.tv_series.current ) -}} - {{- if ( eq .tmdb_id $series_tmdb_id ) -}} - {{- $series = . -}} - {{- end -}} + {{- if ( and ( isset . "tmdb_id" ) ( eq .tmdb_id $series_tmdb_id ) ) -}} + {{- $series = . -}} + {{ warnf "%v" $series }} + {{- end -}} {{- end -}} {{- range ( index .g.Site.Data.tv_series.log ) -}} - {{- if ( eq .tmdb_id $series_tmdb_id ) -}} - {{- $series = . -}} - {{- end -}} + {{- if ( and ( isset . "tmdb_id" ) ( eq .tmdb_id $series_tmdb_id ) ) -}} + {{- $series = . -}} + {{ warnf "%v" $series }} + {{- end -}} {{- end -}} {{- range ( index .g.Site.Data.tv_series.wishlist ) -}} - {{- if ( eq .tmdb_id $series_tmdb_id ) -}} - {{- $series = . -}} - {{- end -}} + {{- if ( and ( isset . "tmdb_id" ) ( eq .tmdb_id $series_tmdb_id ) ) -}} + {{- $series = . -}} + {{ warnf "%v" $series }} + {{- end -}} {{- end -}} {{- return $series -}} diff --git a/layouts/partials/tv/episodes/table-body.html b/layouts/partials/tv/episodes/table-body.html index 335e3f0..2df799f 100644 --- a/layouts/partials/tv/episodes/table-body.html +++ b/layouts/partials/tv/episodes/table-body.html @@ -5,42 +5,49 @@ {{ end }} {{ range ( sort ( index $.Site.Data.tv_episodes ( .Scratch.Get "listMode" ) ) ( .Scratch.Get "filterCol" ) ( .Scratch.Get "filterDir" ) ) }} - - - {{- 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 ) -}} + + + {{- with ( index . "Series Title" ) -}} + {{ . }} {{- else -}} - Unknown series + {{- $series := partial "series_by_id" ( dict "g" $ "tmdb_id" .series.tmdb_id ) .series.tmdb_id -}} + {{- if ( not ( eq $series "" ) ) -}} + {{- partial "cite" ( dict "c" . "g" $ "section" "tv/series" "schemaType" "TVSeries" "title" $series.title "titleLang" $series.original_language "titleTrans" $series.original_name ) -}} + {{- else -}} + Unknown series + {{- end -}} {{- end -}} - {{- end -}} - + - - {{- 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 . "Episode Title" ) -}} + {{- partial "cite" ( dict "c" . "g" $ "section" "tv/episodes" "schemaType" "TVEpisode" "title" ( index . "Episode Title" ) ) -}} + ({{ index . "Episode Number" }}) + {{- else -}} + {{- partial "cite" ( dict "c" . "g" $ "section" "tv/episodes" "schemaType" "TVEpisode" "title" .title ) -}} + ({{ printf "S%vE%v" .season_number .episode_number }}) + {{- end -}} + - - {{- if ( or ( index . "Date Watched" ) .date_finished ) -}} - {{- with ( index . "Date Watched" ) -}} + + {{- 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 -}} - {{- time.Format "Jan 2, 2006" .date_finished -}} + n/a {{- end -}} - {{- if ( or .is_rewatch .Rewatch ) }} ↻{{ end -}} - {{- else -}} - n/a - {{- end -}} - - + + {{ end }} {{ end }} diff --git a/layouts/partials/tv/series/table-body.html b/layouts/partials/tv/series/table-body.html index f260e21..7e73b16 100644 --- a/layouts/partials/tv/series/table-body.html +++ b/layouts/partials/tv/series/table-body.html @@ -11,7 +11,7 @@ - {{- with ( index . "name" ) -}} + {{- with ( index . "title" ) -}} - {{- with ( index . "name" ) -}} + {{- with ( index . "title" ) -}} {{ end }} {{ else if ( eq ( .Scratch.Get "listMode" ) "wishlist" ) }} - {{ range ( sort $.Site.Data.tv_series.wishlist "name" "asc" ) }} + {{ range ( sort $.Site.Data.tv_series.wishlist "title" "asc" ) }} {{ with .date_added }} @@ -72,7 +72,7 @@ - {{- with ( index . "name" ) -}} + {{- with ( index . "title" ) -}}