feat: custom sections, TV series section, fix table wrapping

This commit is contained in:
Ben Goldsworthy 2025-01-12 15:52:54 +01:00
parent 995a539fa9
commit 39c64bf51a
No known key found for this signature in database
17 changed files with 402 additions and 204 deletions

View file

@ -1,9 +1,11 @@
{{- with .date_started -}}
{{- time.Format "Jan 2, 2006" . -}}
{{- time.Format "Jan 2, 2006" . -}}
{{- else -}}
Unknown
{{- end -}}–{{- with .date_finished -}}
{{- time.Format "Jan 2, 2006" . -}}
Unknown
{{- end }}
to<br />
{{ with .date_finished -}}
{{- time.Format "Jan 2, 2006" . -}}
{{- else -}}
Unknown
Unknown
{{- end -}}

View file

@ -1,7 +1,14 @@
{{ if ( eq ( .Scratch.Get "listMode" ) "current" ) }}
{{ range ( sort $.Site.Data.books.current "date_started" "desc" ) }}
<tr>
<td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ else }}n/a{{ end }}</td>
<td>
{{ with .date_added }}
{{ time.Format "Jan 2, 2006" . }}
{{ else }}
n/a
{{ end }}
</td>
<td>
{{- partial "books/rows/title.html" ( dict "c" . "g" $ ) -}}
@ -21,20 +28,28 @@
<td>
{{- with .date_started -}}
Since {{ time.Format "Jan 2, 2006" . -}}
Since
{{ time.Format "Jan 2, 2006" . -}}
{{- else -}}
Unknown
Unknown
{{- end -}}
</td>
</tr>
{{ end }}
{{ else if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
<tr>
<td colspan=5><h3>Diary</h3></td>
<td colspan="5"><h3>Diary</h3></td>
</tr>
{{ range ( sort ( where $.Site.Data.books.log "Date Finished" "!=" "" ) "Date Finished" "desc" ) }}
<tr>
<td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ else }}n/a{{ end }}</td>
<td>
{{ with .date_added }}
{{ time.Format "Jan 2, 2006" . }}
{{ else }}
n/a
{{ end }}
</td>
<td>
{{- partial "books/rows/title.html" ( dict "c" . "g" $ ) -}}
@ -58,11 +73,18 @@
</tr>
{{ end }}
<tr>
<td colspan=5><h3>Assorted</h3></td>
<td colspan="5"><h3>Assorted</h3></td>
</tr>
{{ range ( sort ( where $.Site.Data.books.log "Date Finished" "" ) "Title" "asc" ) }}
<tr>
<td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ else }}n/a{{ end }}</td>
<td>
{{ with .date_added }}
{{ time.Format "Jan 2, 2006" . }}
{{ else }}
n/a
{{ end }}
</td>
<td>
{{- partial "books/rows/title.html" ( dict "c" . "g" $ ) -}}
@ -88,7 +110,14 @@
{{ else if ( eq ( .Scratch.Get "listMode" ) "wishlist" ) }}
{{ range ( sort $.Site.Data.books.wishlist "Title" "asc" ) }}
<tr>
<td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ else }}n/a{{ end }}</td>
<td>
{{ with .date_added }}
{{ time.Format "Jan 2, 2006" . }}
{{ else }}
n/a
{{ end }}
</td>
<td>
{{- partial "books/rows/title.html" ( dict "c" . "g" $ ) -}}
@ -105,8 +134,6 @@
<td>
{{- partial "books/rows/publish-date.html" . -}}
</td>
<td>n/a</td>
</tr>
{{ end }}
{{ end }}

View file

@ -2,4 +2,6 @@
<th>Title</th>
<th>Author(s)</th>
<th>Publication Date</th>
<th>Dates Read</th>
{{ if ( not ( eq ( .Scratch.Get "listMode" ) "wishlist" ) ) }}
<th>Dates Read</th>
{{ end }}

View file

@ -1,81 +1,78 @@
{{ if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
<tr>
<td colspan=4><h3>Diary</h3></td>
<td colspan="4"><h3>Diary</h3></td>
</tr>
{{ range ( sort ( where $.Site.Data.films.log "date_finished" "!=" "" ) "date_finished" "desc" ) }}
<tr>
<td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
<tr>
<td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
<td>
{{- partial "cite" ( dict "c" . "g" $ "section" "films" "schemaType" "Movie" "title" .title "titleLang" .original_language "titleTrans" .original_title ) -}}
<td>
{{- 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>
{{- with .comments -}}
<p class="comments">Comments: {{ . }}</p>
{{- end -}}
</td>
<td>{{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
<td>
{{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }}
</td>
<td>
{{- if .date_finished -}}
{{- time.Format "Jan 2, 2006" .date_finished -}}
{{- if .is_repeat }} &#x21BB;{{ end -}}
{{- else -}}
n/a
{{- end -}}
</td>
</tr>
<td>
{{- if .date_finished -}}
{{- time.Format "Jan 2, 2006" .date_finished -}}
{{- if .is_repeat }}&#x21BB;{{ end -}}
{{- else -}}
n/a
{{- end -}}
</td>
</tr>
{{ end }}
<tr>
<td colspan=4><h3>Assorted</h3></td>
<td colspan="4"><h3>Assorted</h3></td>
</tr>
{{ range ( sort ( where $.Site.Data.films.log "date_finished" "" ) "title" "asc" ) }}
<tr>
<td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
<tr>
<td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
<td>
{{- partial "cite" ( dict "c" . "g" $ "section" "films" "schemaType" "Movie" "title" .title "titleLang" .original_language "titleTrans" .original_title ) -}}
<td>
{{- 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>
{{- with .comments -}}
<p class="comments">Comments: {{ . }}</p>
{{- end -}}
</td>
<td>{{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
<td>
{{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }}
</td>
<td>
{{- if .date_finished -}}
{{- time.Format "Jan 2, 2006" .date_finished -}}
{{- if .is_repeat }} &#x21BB;{{ end -}}
{{- else -}}
n/a
{{- end -}}
</td>
</tr>
<td>
{{- if .date_finished -}}
{{- time.Format "Jan 2, 2006" .date_finished -}}
{{- 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>
<tr>
<td>{{ with .date_added }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
<td>
{{- partial "cite" ( dict "c" . "g" $ "section" "films" "schemaType" "Movie" "title" .title "titleLang" .original_language "titleTrans" .original_title ) -}}
<td>
{{- 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>
{{- with .comments -}}
<p class="comments">Comments: {{ . }}</p>
{{- end -}}
</td>
<td>{{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }}</td>
<td>
{{- if .date_finished -}}
{{- time.Format "Jan 2, 2006" .date_finished -}}
{{- if .is_repeat }} &#x21BB;{{ end -}}
{{- else -}}
n/a
{{- end -}}
</td>
</tr>
<td>
{{ with .release_date }}{{ time.Format "Jan 2, 2006" . }}{{ end }}
</td>
</tr>
{{ end }}
{{ end }}

View file

@ -1,4 +1,6 @@
<th>Date Added</th>
<th>Title</th>
<th>Release Date</th>
<th>Date Watched</th>
{{ if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
<th>Date Watched</th>
{{ end }}

View file

@ -1,78 +1,90 @@
{{ if ( eq ( .Scratch.Get "listMode" ) "current" ) }}
{{ range ( sort $.Site.Data.games.current "Date Started" "desc" ) }}
<tr>
<td>
<tr>
<td>TODO</td>
<td>
{{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" ) -}}
</td>
<td>{{ index . "Date Released" }}</td>
<td>{{ .Platforms }}</td>
<td>
{{- if index . "Date Started" -}}
Since {{ time.Format "Jan 2, 2006" ( index . "Date Started" ) -}}
{{- else -}}
Unknown
{{- end -}}
</td>
</tr>
</td>
<td>{{ .Platforms }}</td>
<td>{{ index . "Date Released" }}</td>
<td>
{{- if index . "Date Started" -}}
Since
{{ time.Format "Jan 2, 2006" ( index . "Date Started" ) -}}
{{- else -}}
Unknown
{{- end -}}
</td>
</tr>
{{ end }}
{{ else if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
<tr>
<td colspan=4><h3>Diary</h3></td>
<td colspan="6"><h3>Diary</h3></td>
</tr>
{{ range ( sort ( where $.Site.Data.games.log "Date Finished" "!=" "" ) "Date Finished" "desc" ) }}
<tr>
<td>
<tr>
<td>TODO</td>
<td>
{{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" ) -}}
</td>
<td>{{ index . "Date Released" }}</td>
<td>{{ .Platforms }}</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 -}}
{{- if index . "Level of Completion" }} <span class="games__level-of-completion">({{ index . "Level of Completion" }})</span>{{- end -}}
</td>
</tr>
</td>
<td>{{ .Platforms }}</td>
<td>{{ index . "Date Released" }}</td>
<td>
{{- with index . "Level of Completion" }}
{{ . }}
{{- 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>
<td colspan="6"><h3>Assorted</h3></td>
</tr>
{{ range ( sort ( where $.Site.Data.games.log "Date Finished" "" ) "Title" "asc" ) }}
<tr>
<td>
<tr>
<td>TODO</td>
<td>
{{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" ) -}}
</td>
<td>{{ index . "Date Released" }}</td>
<td>{{ .Platforms }}</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 -}}
{{- if index . "Level of Completion" }} <span class="games__level-of-completion">({{ index . "Level of Completion" }})</span>{{- end -}}
</td>
</tr>
</td>
<td>{{ .Platforms }}</td>
<td>{{ index . "Date Released" }}</td>
<td>
{{- with index . "Level of Completion" }}
{{ . }}
{{- 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" ) }}
{{ range ( sort $.Site.Data.games.wishlist "Title" "asc" ) }}
<tr>
<td>
<tr>
<td>TODO</td>
<td>
{{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" ) -}}
</td>
<td>{{ index . "Date Released" }}</td>
<td>{{ .Platforms }}</td>
<td>n/a</td>
</tr>
</td>
<td>{{ .Platforms }}</td>
<td>{{ index . "Date Released" }}</td>
</tr>
{{ end }}
{{ end }}

View file

@ -1,4 +1,8 @@
<th>Date Added</th>
<th>Title</th>
<th>Platform(s)</th>
<th>Release Year</th>
<th>Platform(s) Played</th>
<th>Date Played</th>
{{ if ( not ( eq ( .Scratch.Get "listMode" ) "wishlist" ) ) }}
<th>Level of Completion</th>
<th>Dates Played</th>
{{ end }}

View file

@ -1,18 +1,38 @@
<header class="site-header">
<header class="site-header">
{{ block "header" . }}
<h1 class="site-header__title" itemprop="name"><a href="{{ .Site.Home.RelPermalink }}">{{ .Site.Title }}</a></h1>
<p class="site-header__tagline" itemprop="about">Views my own. Discussion ≠ endorsement. Do try this at home.</p>
<p class="site-header__icons">~
<a href="mailto:{{ $.Site.Author.email }}" rel="me">&#128231;</a> ~
<a href="{{ .Site.Params.codeURL }}">&#128187;</a> ~
<a href="/{{ .Site.Params.keyfile }}">&#128272;</a> ~
<a href="/index.xml"><img class="feed-icon" src="/images/feed-icon.svg"></a> ~
<h1
class="site-header__title"
itemprop="name"
>
<a href="{{ .Site.Home.RelPermalink }}">{{ .Site.Title }}</a>
</h1>
<p
class="site-header__tagline"
itemprop="about"
>
Views my own. Discussion ≠ endorsement. Do try this at home.
</p>
<p class="site-header__icons">
~
<a
href="mailto:{{ $.Site.Author.email }}"
rel="me"
>&#128231;</a
>
~ <a href="{{ .Site.Params.codeURL }}">&#128187;</a> ~
<a href="/{{ .Site.Params.keyfile }}">&#128272;</a> ~
<a href="/index.xml"
><img
class="feed-icon"
src="/images/feed-icon.svg"
/></a>
~
</p>
<nav class="site-header__nav">
<ul>
{{ range .Site.Sections.ByTitle }}
<a href="{{ .RelPermalink }}"><li>{{ .Title | safeHTML }}</li></a>
<a href="{{ .RelPermalink }}"><li>{{ .Title | safeHTML }}</li></a>
{{ end }}
</ul>
</nav>

View file

@ -1,16 +1,25 @@
{{ if ( .Scratch.Get "listMode" ) }}
<table>
<thead>
<tr>
<table>
<thead>
<tr>
{{ if ( and ( in site.Params.mainSections .Section ) ( in "current log wishlist" ( .Scratch.Get "page" ) ) ) }}
{{ if eq .Type "tv" }}
{{ partial ( printf "%s/%s/%s" .Section .Parent.Slug "table-header" ) . }}
{{ else }}
{{ partial ( printf "%s/%s" .Section "table-header" ) . }}
{{ end }}
{{ end }}
</tr>
</thead>
<tbody>
{{ if ( and ( in site.Params.mainSections .Section ) ( in "current log wishlist" ( .Scratch.Get "page" ) ) ) }}
{{ partial ( printf "%s/%s" .Section "table-header" ) . }}
{{ if eq .Type "tv" }}
{{ partial ( printf "%s/%s/%s" .Section .Parent.Slug "table-body" ) . }}
{{ else }}
{{ partial ( printf "%s/%s" .Section "table-body" ) . }}
{{ end }}
{{ end }}
</tr>
</thead>
<tbody>
{{ if ( and ( in site.Params.mainSections .Section ) ( in "current log wishlist" ( .Scratch.Get "page" ) ) ) }}
{{ partial ( printf "%s/%s" .Section "table-body" ) . }}
{{ end }}
</tbody>
<table>
</tbody>
<table></table>
</table>
{{ end }}

View file

@ -0,0 +1,86 @@
{{ if ( eq ( .Scratch.Get "listMode" ) "current" ) }}
{{ range ( sort $.Site.Data.tv_series.current "date_started" "desc" ) }}
<tr>
<td>
{{ with .date_added }}
{{ time.Format "Jan 2, 2006" . }}
{{ else }}
n/a
{{ end }}
</td>
<td>
{{- with ( index . "name" ) -}}
<cite
class="cite"
itemscope
itemtype="TVSeries"
>{{ . }}</cite
>
{{- end -}}
</td>
<td>
{{- partial "books/rows/read-dates.html" . -}}
</td>
</tr>
{{ end }}
{{ else if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
{{ if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
{{ .Scratch.Set "filterCol" "date_finished" }}
{{ .Scratch.Set "filterDir" "desc" }}
{{ end }}
{{ range ( sort $.Site.Data.tv_series.log ( .Scratch.Get "filterCol" ) ( .Scratch.Get "filterDir" ) ) }}
<tr>
<td>
{{ with .date_added }}
{{ time.Format "Jan 2, 2006" . }}
{{ else }}
n/a
{{ end }}
</td>
<td>
{{- with ( index . "name" ) -}}
<cite
class="cite"
itemscope
itemtype="TVSeries"
>{{ . }}</cite
>
{{- end -}}
</td>
<td>
{{- partial "books/rows/read-dates.html" . -}}
</td>
</tr>
{{ end }}
{{ else if ( eq ( .Scratch.Get "listMode" ) "wishlist" ) }}
{{ range ( sort $.Site.Data.tv_series.wishlist "name" "asc" ) }}
<tr>
<td>
{{ with .date_added }}
{{ time.Format "Jan 2, 2006" . }}
{{ else }}
n/a
{{ end }}
</td>
<td>
{{- with ( index . "name" ) -}}
<cite
class="cite"
itemscope
itemtype="TVSeries"
>{{ . }}</cite
>
{{- end -}}
</td>
</tr>
{{ end }}
{{ end }}

View file

@ -0,0 +1,5 @@
<th>Date Added</th>
<th>Series Title</th>
{{ if ( not ( eq ( .Scratch.Get "listMode" ) "wishlist" ) ) }}
<th>Dates Watched</th>
{{ end }}