add stats, make work with new key names, etc.

This commit is contained in:
Ben Goldsworthy 2024-07-23 09:57:11 +02:00
parent 4f55dc1884
commit 78d829e1ac
Signed by: Rumperuu
SSH key fingerprint: SHA256:e5XfzNOr9UvWpEzyLfw0GtTMZWIFh3NmxH+/qQIi3xE
18 changed files with 312 additions and 151 deletions

View file

@ -3,8 +3,8 @@ $dark: #020202;
$light: #fffff0; $light: #fffff0;
// Fonts // Fonts
$defaultFont: "Palatino Linotype", "Book Antiqua", Palatino, serif; $defaultFont: "Domitian", "Palatino Linotype", "Book Antiqua", Palatino, serif;
$codeFont: "Input Mono", "Lucida Console", Monaco, monospace; $codeFont: /*"Input Mono", */"Lucida Console", Monaco, monospace;
// Breakpoints // Breakpoints
$breakpoints: ( $breakpoints: (

View file

@ -216,11 +216,22 @@ cite,
} }
} }
table .cite {
font-style: normal;
}
.episode-number, .episode-number,
.authors--addtional, .authors--additional,
.comments,
.edition,
.year--original { .year--original {
font-size: 0.75em; font-size: 0.75em;
opacity: 0.8; }
.comments,
.edition {
margin-block-start: 0.4em;
margin-block-end: 0;
} }
code, code,
@ -306,7 +317,12 @@ kbd {
* Special Text * Special Text
*/ */
:where([title]) { :where([title]) {
text-decoration: underline; text-decoration: underline;
text-decoration: underline dotted; text-decoration: underline dotted;
&:not(a *) {
cursor: help;
}
} }

View file

@ -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;
}
}
}

View file

@ -57,6 +57,7 @@
@import "components/icons"; @import "components/icons";
@import "components/item-tile"; @import "components/item-tile";
@import "components/table"; @import "components/table";
@import "components/log-stats";
@import "pages/home"; @import "pages/home";
@import "pages/collection"; @import "pages/collection";

View file

@ -9,7 +9,8 @@
{{ define "main-header" }} {{ define "main-header" }}
<header class="site-content__header"> <header class="site-content__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 "" ) ) ) }} {{ if ( or ( in "books" ( delimit $section "" ) ) ( in "games" ( delimit $section "" ) ) ) }}
<a href="/{{ delimit $section "" }}/current">Current</a> ~ <a href="/{{ delimit $section "" }}/current">Current</a> ~
{{ end }} {{ end }}
@ -28,18 +29,27 @@
{{ end }} {{ end }}
{{ define "main-body" }} {{ define "main-body" }}
<main class="site-content__body"> <main class="site-content__body">
{{ if .File }} {{ if .File }}
{{ .Scratch.Set "page" ( index ( split .File.Dir "/" ) 1 ) }} {{ .Scratch.Set "page" ( index ( split .File.Dir "/" ) 1 ) }}
{{ if ( in "current log wishlist" ( .Scratch.Get "page" ) ) }} {{ if ( in "current log wishlist" ( .Scratch.Get "page" ) ) }}
{{ if ( eq ( .Scratch.Get "page" ) "current" ) }} {{ if ( eq ( .Scratch.Get "page" ) "current" ) }}
{{ .Scratch.Set "listMode" "current" }} {{ .Scratch.Set "listMode" "current" }}
{{ else if ( eq ( .Scratch.Get "page" ) "log" ) }} {{ else if ( eq ( .Scratch.Get "page" ) "log" ) }}
{{ .Scratch.Set "listMode" "log" }} {{ .Scratch.Set "listMode" "log" }}
{{ else if ( eq ( .Scratch.Get "page" ) "wishlist" ) }} {{ else if ( eq ( .Scratch.Get "page" ) "wishlist" ) }}
{{ .Scratch.Set "listMode" "wishlist" }} {{ .Scratch.Set "listMode" "wishlist" }}
{{ end }} {{ end }}
{{ partial "stats" . }}
{{ partial "table" . }} {{ partial "table" . }}
{{ end }} {{ end }}
{{ end }} {{ end }}
</main> </main>

View file

@ -1,7 +0,0 @@
<p class="year">{{- index . "Year Published" -}}
{{- if ( index . "Original Publication Year" ) -}}
{{- if ( ne ( index . "Original Publication Year" ) ( index . "Year Published" ) ) -}}
&nbsp;<span class="year--original">(<abbr title="original publication year">orig.</abbr>&nbsp;{{ index . "Original Publication Year" }})</span>
{{- end -}}
{{- end -}}
</p>

View file

@ -0,0 +1,34 @@
{{- with .Author -}}
<p class="authors">{{ . }}</p>
{{- 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 -}}
<p class="authors">{{ delimit ( uniq $authors_names ) ", " }}</p>
{{- end -}}
{{- if .contributors -}}
{{- $translators_names := slice -}}
{{- range ( where .contributors "role" "like" `[tT]ranslat` ) -}}
{{- $translators_names = $translators_names | append .name -}}
{{- end -}}
{{- with $translators_names -}}
<p class="authors--additional">Translator(s): {{ delimit ( uniq . ) ", " }}</p>
{{- end -}}
{{- end -}}
{{- with ( index . "Additional Authors" ) -}}
<p class="authors--additional">Additional Author(s): {{ . }}</p>
{{- end -}}

View file

@ -0,0 +1,7 @@
<p class="year">{{- .publish_date -}}
{{- if .first_publish_date -}}
{{- if ( ne .first_publish_date .publish_date ) -}}
&nbsp;<span class="year--original">(<abbr title="original publication year">orig.</abbr>&nbsp;{{ .first_publish_date }})</span>
{{- end -}}
{{- end -}}
</p>

View file

@ -0,0 +1,9 @@
{{- with .date_started -}}
{{- time.Format "Jan 2, 2006" . -}}
{{- else -}}
Unknown
{{- end -}}&ndash;{{- with .date_finished -}}
{{- time.Format "Jan 2, 2006" . -}}
{{- else -}}
Unknown
{{- end -}}

View file

@ -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 -}}

View file

@ -1,23 +1,26 @@
{{ if ( eq ( .Scratch.Get "listMode" ) "current" ) }} {{ if ( eq ( .Scratch.Get "listMode" ) "current" ) }}
{{ range ( sort $.Site.Data.books.current "Date Started" "desc" ) }} {{ range ( sort $.Site.Data.books.current "date_started" "desc" ) }}
<tr> <tr>
<td>{{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }}</td> <td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ else }}n/a{{ end }}</td>
<td> <td>
{{- partial "cite" ( dict "c" . "schemaType" "Book" ) -}} {{- partial "books/rows/title.html" ( dict "c" . "g" $ ) -}}
</td>
<td> {{- with .comments -}}
<p class="author">{{ .Author }}</p> <p class="comments">Comments: {{ . }}</p>
{{- if ( index . "Additional Authors" ) -}}
<p class="author--additional">Additional: {{ index . "Additional Authors" }}</p>
{{- end -}} {{- end -}}
</td> </td>
<td> <td>
{{- partial "books/publication-year.html" . -}} {{- partial "books/rows/authors.html" . -}}
</td> </td>
<td> <td>
{{- if index . "Date Started" -}} {{- partial "books/rows/publish-date.html" . -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Started" ) -}} </td>
{{- end -}}&ndash;
<td>
{{- partial "books/rows/read-dates.html" . -}}
</td> </td>
</tr> </tr>
{{ end }} {{ end }}
@ -27,39 +30,26 @@
</tr> </tr>
{{ range ( sort ( where $.Site.Data.books.log "Date Finished" "!=" "" ) "Date Finished" "desc" ) }} {{ range ( sort ( where $.Site.Data.books.log "Date Finished" "!=" "" ) "Date Finished" "desc" ) }}
<tr> <tr>
<td>{{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }}</td> <td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ else }}n/a{{ end }}</td>
<td> <td>
<p> {{- partial "books/rows/title.html" ( dict "c" . "g" $ ) -}}
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
{{ range . }} {{- with .comments -}}
<a href="{{ .RelPermalink }}"> <p class="comments">Comments: {{ . }}</p>
{{ 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 -}} {{- end -}}
</td> </td>
<td> <td>
{{- partial "books/publication-year.html" . -}} {{- partial "books/rows/authors.html" . -}}
</td> </td>
<td> <td>
{{- if index . "Date Started" -}} {{- partial "books/rows/publish-date.html" . -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Started" ) -}} </td>
{{- else -}}
Unknown <td>
{{- end -}}&ndash;{{- if index . "Date Finished" -}} {{- partial "books/rows/read-dates.html" . -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Finished" ) -}}
{{- else -}}
Unknown
{{- end -}}
</td> </td>
</tr> </tr>
{{ end }} {{ end }}
@ -68,68 +58,50 @@
</tr> </tr>
{{ range ( sort ( where $.Site.Data.books.log "Date Finished" "" ) "Title" "asc" ) }} {{ range ( sort ( where $.Site.Data.books.log "Date Finished" "" ) "Title" "asc" ) }}
<tr> <tr>
<td>{{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }}</td> <td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ else }}n/a{{ end }}</td>
<td> <td>
<p> {{- partial "books/rows/title.html" ( dict "c" . "g" $ ) -}}
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
{{ range . }} {{- with .comments -}}
<a href="{{ .RelPermalink }}"> <p class="comments">Comments: {{ . }}</p>
{{ 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 -}} {{- end -}}
</td> </td>
<td> <td>
{{- partial "books/publication-year.html" . -}} {{- partial "books/rows/authors.html" . -}}
</td> </td>
<td> <td>
{{- if index . "Date Started" -}} {{- partial "books/rows/publish-date.html" . -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Started" ) -}} </td>
{{- else -}}
Unknown <td>
{{- end -}}&ndash;{{- if index . "Date Finished" -}} {{- partial "books/rows/read-dates.html" . -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Finished" ) -}}
{{- else -}}
Unknown
{{- end -}}
</td> </td>
</tr> </tr>
{{ end }} {{ end }}
{{ else if ( eq ( .Scratch.Get "listMode" ) "wishlist" ) }} {{ else if ( eq ( .Scratch.Get "listMode" ) "wishlist" ) }}
{{ range ( sort $.Site.Data.books.wishlist "Title" "asc" ) }} {{ range ( sort $.Site.Data.books.wishlist "Title" "asc" ) }}
<tr> <tr>
<td>{{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }}</td> <td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ else }}n/a{{ end }}</td>
<td> <td>
<p> {{- partial "books/rows/title.html" ( dict "c" . "g" $ ) -}}
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
{{ range . }} {{- with .comments -}}
<a href="{{ .RelPermalink }}"> <p class="comments">Comments: {{ . }}</p>
{{ 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 -}} {{- end -}}
</td> </td>
<td> <td>
{{- partial "books/publication-year.html" . -}} {{- partial "books/rows/authors.html" . -}}
</td> </td>
<td>
{{- partial "books/rows/publish-date.html" . -}}
</td>
<td>n/a</td> <td>n/a</td>
</tr> </tr>
{{ end }} {{ end }}

View file

@ -1,16 +1,21 @@
{{- $itemType := default "CreativeWork" .schemaType -}} {{- $itemType := default "CreativeWork" .schemaType -}}
{{- $pages := where ( where .g.Site.Pages "Section" .section ) "title" .title | first 1 -}}
{{- with .c -}} {{- with .c -}}
<cite {{- with $pages -}}{{- range . -}}<a href="{{ .RelPermalink }}">{{- end -}}{{- end -}}
class="cite{{ with .CiteStyle }} cite--{{ . }}{{ end }}" <cite
itemscope class="cite{{ with .citeStyle }} cite--{{ . }}{{ end }}"
itemprop="citation" itemscope
itemtype="https://schema.org/{{- $itemType -}}" itemprop="citation"
{{- if .TitleLang -}} itemtype="https://schema.org/{{- $itemType -}}"
lang="{{- .TitleLang -}}" {{- if $.titleTrans -}}
title="{{- .TitleTrans -}}" lang="{{- $.titleLang -}}"
{{- end -}}> title="{{- $.titleTrans -}}"
{{- default .Title $.title -}} {{- end -}}>
</cite> {{- default .Title $.title -}}
{{- if .Edition }} <span class="edition">({{ .Edition }})</span>{{- end -}} </cite>
{{- with $pages -}}</a>{{- end -}}
{{- with $.edition }}<p class="edition">{{ . }}</p>{{- end -}}
{{- end -}} {{- end -}}

View file

@ -2,16 +2,23 @@
<tr> <tr>
<td colspan=4><h3>Diary</h3></td> <td colspan=4><h3>Diary</h3></td>
</tr> </tr>
{{ range ( sort ( where $.Site.Data.films.log "date_completed" "!=" "" ) "date_completed" "desc" ) }} {{ range ( sort ( where $.Site.Data.films.log "date_finished" "!=" "" ) "date_finished" "desc" ) }}
<tr> <tr>
<td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td> <td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
<td> <td>
{{ .title }} {{- partial "cite" ( dict "c" . "g" $ "section" "films" "schemaType" "Movie" "title" .title "titleLang" .original_language "titleTrans" .original_title ) -}}
{{- with .comments -}}
<p class="comments">Comments: {{ . }}</p>
{{- end -}}
</td> </td>
<td>{{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td> <td>{{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
<td> <td>
{{- if .date_completed -}} {{- if .date_finished -}}
{{- time.Format "Jan 2, 2006" .date_completed -}} {{- time.Format "Jan 2, 2006" .date_finished -}}
{{- if .is_repeat }} &#x21BB;{{ end -}} {{- if .is_repeat }} &#x21BB;{{ end -}}
{{- else -}} {{- else -}}
n/a n/a
@ -22,24 +29,23 @@
<tr> <tr>
<td colspan=4><h3>Assorted</h3></td> <td colspan=4><h3>Assorted</h3></td>
</tr> </tr>
{{ range ( sort ( where $.Site.Data.films.log "date_completed" "" ) "title" "asc" ) }} {{ range ( sort ( where $.Site.Data.films.log "date_finished" "" ) "title" "asc" ) }}
<tr> <tr>
<td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td> <td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
<td> <td>
{{- 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 ) -}}
{{ range . }}
<a href="{{ .RelPermalink }}"> {{- with .comments -}}
{{ end }} <p class="comments">Comments: {{ . }}</p>
{{- end -}} {{- end -}}
<cite class="film">{{ .title }}</cite>
{{- with ( where ( where $.Site.Pages "Section" "films" ) "title" .title ) -}}
</a>
{{- end -}}
</td> </td>
<td>{{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td> <td>{{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
<td> <td>
{{- if .date_completed -}} {{- if .date_finished -}}
{{- time.Format "Jan 2, 2006" .date_completed -}} {{- time.Format "Jan 2, 2006" .date_finished -}}
{{- if .is_repeat }} &#x21BB;{{ end -}} {{- if .is_repeat }} &#x21BB;{{ end -}}
{{- else -}} {{- else -}}
n/a n/a
@ -51,21 +57,20 @@
{{ range ( sort $.Site.Data.films.wishlist "title" "asc" ) }} {{ range ( sort $.Site.Data.films.wishlist "title" "asc" ) }}
<tr> <tr>
<td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td> <td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
<td> <td>
{{- 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 ) -}}
{{ range . }}
<a href="{{ .RelPermalink }}"> {{- with .comments -}}
{{ end }} <p class="comments">Comments: {{ . }}</p>
{{- end -}}
<cite class="film">{{ .title }}</cite>
{{- with ( where ( where $.Site.Pages "Section" "films" ) "title" .title ) -}}
</a>
{{- end -}} {{- end -}}
</td> </td>
<td>{{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td> <td>{{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
<td> <td>
{{- if .date_completed -}} {{- if .date_finished -}}
{{- time.Format "Jan 2, 2006" .date_completed -}} {{- time.Format "Jan 2, 2006" .date_finished -}}
{{- if .is_repeat }} &#x21BB;{{ end -}} {{- if .is_repeat }} &#x21BB;{{ end -}}
{{- else -}} {{- else -}}
n/a n/a

View file

@ -1,4 +1,4 @@
<th>Date Added</th> <th>Date Added</th>
<th>Title</th> <th>Title</th>
<th>Release Year</th> <th>Release Date</th>
<th>Date Watched</th> <th>Date Watched</th>

View file

@ -2,7 +2,7 @@
{{ range ( sort $.Site.Data.games.current "Date Started" "desc" ) }} {{ range ( sort $.Site.Data.games.current "Date Started" "desc" ) }}
<tr> <tr>
<td> <td>
{{- partial "cite" ( dict "c" . "schemaType" "VideoGame" ) -}} {{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" ) -}}
</td> </td>
<td>{{ index . "Date Released" }}</td> <td>{{ index . "Date Released" }}</td>
<td>{{ .Platforms }}</td> <td>{{ .Platforms }}</td>
@ -22,7 +22,7 @@
{{ range ( sort ( where $.Site.Data.games.log "Date Finished" "!=" "" ) "Date Finished" "desc" ) }} {{ range ( sort ( where $.Site.Data.games.log "Date Finished" "!=" "" ) "Date Finished" "desc" ) }}
<tr> <tr>
<td> <td>
{{- partial "cite" ( dict "c" . "schemaType" "VideoGame" ) -}} {{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" ) -}}
</td> </td>
<td>{{ index . "Date Released" }}</td> <td>{{ index . "Date Released" }}</td>
<td>{{ .Platforms }}</td> <td>{{ .Platforms }}</td>
@ -46,7 +46,7 @@
{{ range ( sort ( where $.Site.Data.games.log "Date Finished" "" ) "Title" "asc" ) }} {{ range ( sort ( where $.Site.Data.games.log "Date Finished" "" ) "Title" "asc" ) }}
<tr> <tr>
<td> <td>
{{- partial "cite" ( dict "c" . "schemaType" "VideoGame" ) -}} {{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" ) -}}
</td> </td>
<td>{{ index . "Date Released" }}</td> <td>{{ index . "Date Released" }}</td>
<td>{{ .Platforms }}</td> <td>{{ .Platforms }}</td>
@ -68,7 +68,7 @@
{{ range ( sort $.Site.Data.games.wishlist "Title" "asc" ) }} {{ range ( sort $.Site.Data.games.wishlist "Title" "asc" ) }}
<tr> <tr>
<td> <td>
{{- partial "cite" ( dict "c" . "schemaType" "VideoGame" ) -}} {{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" ) -}}
</td> </td>
<td>{{ index . "Date Released" }}</td> <td>{{ index . "Date Released" }}</td>
<td>{{ .Platforms }}</td> <td>{{ .Platforms }}</td>

View file

@ -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 -}}

View file

@ -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" ) -}}
<details class="log-stats">
<summary>Summary</summary>
<div>
<p>Total: {{ $total }}</p>
{{- if eq $list_mode "log" -}}
<p>Last 12 months: {{ $this_year_total }}</p>
<p>Last 3 months: {{ $this_quarter_total }}</p>
<p>Last month: {{ $this_month_total }}</p>
{{- end -}}
</div>
</details>
{{- end -}}

View file

@ -1,25 +1,45 @@
{{ if ( eq ( .Scratch.Get "listMode" ) "log" ) }} {{ if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
{{ 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" }} {{ .Scratch.Set "filterDir" "desc" }}
{{ end }} {{ 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" ) ) }}
<tr> <tr>
<td> <td>
{{- partial "cite" ( dict "c" . "schemaType" "TVSeries" "title" ( index . "Series Title" ) ) -}} {{- with ( index . "Series Title" ) -}}
<cite class="cite" itemscope itemtype="TVSeries">{{ . }}</cite>
{{- 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 -}}
</td> </td>
<td> <td>
{{- partial "cite" ( dict "c" . "schemaType" "TVEpisode" "title" ( index . "Episode Title" ) ) -}} {{- if ( index . "Episode Title" ) -}}
<span class="episode-number">({{ index . "Episode Number" }})</span> {{- partial "cite" ( dict "c" . "g" $ "section" "tv" "schemaType" "TVEpisode" "title" ( index . "Episode Title" ) ) -}}
<span class="episode-number">({{ index . "Episode Number" }})</span>
{{- else -}}
{{- partial "cite" ( dict "c" . "g" $ "section" "tv" "schemaType" "TVEpisode" "title" .name ) -}}
<span class="episode-number">(S{{ .season_number }}E{{ .episode_number }})</span>
{{- end -}}
</td> </td>
<td> <td>
{{- if ( index . "Date Watched" ) -}} {{- if ( or ( index . "Date Watched" ) .date_finished ) -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Watched" ) -}} {{- with ( index . "Date Watched" ) -}}
{{- if .Rewatch }} &#x21BB;{{ end -}} {{- time.Format "Jan 2, 2006" . -}}
{{- else -}} {{- else -}}
n/a {{- time.Format "Jan 2, 2006" .date_finished -}}
{{- end -}} {{- end -}}
{{- if ( or .is_rewatch .Rewatch ) }} &#x21BB;{{ end -}}
{{- else -}}
n/a
{{- end -}}
</td> </td>
</tr> </tr>
{{ end }} {{ end }}