fix: render games

This commit is contained in:
Ben Goldsworthy 2025-02-21 18:44:27 +01:00
parent 0d736d2869
commit a74da74d43
Signed by: Rumperuu
SSH key fingerprint: SHA256:v3uompaUiPqV2w1/AIRWBSQOxr2dntH9Xs/y8fDnUPU
6 changed files with 56 additions and 32 deletions

View file

@ -9,11 +9,11 @@
itemscope
itemprop="citation"
itemtype="https://schema.org/{{- $itemType -}}"
{{- if $.titleTrans -}}
{{- if .titleTrans -}}
lang="{{- $.titleLang -}}"
title="{{- $.titleTrans -}}"
{{- end -}}>
{{- default .Title $.title -}}
{{- .title -}}
</cite>
{{- with $pages -}}</a>{{- end -}}

View file

@ -0,0 +1,7 @@
{{- with . -}}
{{ with try ( time.Format "Jan 2, 2006" . ) }}
{{ .Value }}
{{ else }}
{{ . }}
{{ end }}
{{- end -}}

View file

@ -0,0 +1 @@
{{ . }}

View file

@ -0,0 +1,7 @@
{{- with . -}}
{{ with try ( time.Format "Jan 2, 2006" . ) }}
{{ .Value }}
{{ else }}
{{ . }}
{{ end }}
{{- end -}}

View file

@ -0,0 +1 @@
{{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" "title" .title "titleLang" .original_language "titleTrans" .original_title ) -}}

View file

@ -1,16 +1,18 @@
{{ if ( eq ( .Scratch.Get "listMode" ) "current" ) }}
{{ range ( sort $.Site.Data.games.current "Date Started" "desc" ) }}
<tr>
<td>TODO</td>
<td>{{ partial "games/rows/date_added.html" .date_added -}}</td>
<td>
{{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" ) -}}
{{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" "title" .title "titleLang" .original_language "titleTrans" .original_title ) -}}
</td>
<td>{{ .Platforms }}</td>
<td>{{ index . "Date Released" }}</td>
<td>{{- partial "games/rows/platforms.html" .platform -}}</td>
<td>
{{- if index . "Date Started" -}}
{{- partial "games/rows/release-date.html" .release_date }}
</td>
<td>
{{- with .date_started -}}
Since
{{ time.Format "Jan 2, 2006" ( index . "Date Started" ) -}}
{{ time.Format "Jan 2, 2006" . -}}
{{- else -}}
Unknown
{{- end -}}
@ -21,26 +23,28 @@
<tr>
<td colspan="6"><h3>Diary</h3></td>
</tr>
{{ 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>
<td>TODO</td>
<td>{{ partial "games/rows/date_added.html" .date_added -}}</td>
<td>
{{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" ) -}}
{{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" "title" .title "titleLang" .original_language "titleTrans" .original_title ) -}}
</td>
<td>{{ .Platforms }}</td>
<td>{{ index . "Date Released" }}</td>
<td>{{- partial "games/rows/platforms.html" .platform -}}</td>
<td>
{{- with index . "Level of Completion" }}
{{- partial "games/rows/release-date.html" .release_date }}
</td>
<td>
{{- with .level_of_completion }}
{{ . }}
{{- end -}}
</td>
<td>
{{- if index . "Date Started" -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Started" ) -}}
{{- with .date_started -}}
{{- time.Format "Jan 2, 2006" . -}}
{{- else -}}
Unknown
{{- end -}}&ndash;{{- if index . "Date Finished" -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Finished" ) -}}
{{- end -}}&ndash;{{- with .date_finished -}}
{{- time.Format "Jan 2, 2006" . -}}
{{- else -}}
Unknown
{{- end -}}
@ -50,26 +54,28 @@
<tr>
<td colspan="6"><h3>Assorted</h3></td>
</tr>
{{ range ( sort ( where $.Site.Data.games.log "Date Finished" "" ) "Title" "asc" ) }}
{{ range ( sort ( where $.Site.Data.games.log "date_finished" "" ) "title" "asc" ) }}
<tr>
<td>TODO</td>
<td>{{ partial "games/rows/date_added.html" .date_added -}}</td>
<td>
{{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" ) -}}
{{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" "title" .title "titleLang" .original_language "titleTrans" .original_title ) -}}
</td>
<td>{{ .Platforms }}</td>
<td>{{ index . "Date Released" }}</td>
<td>{{- partial "games/rows/platforms.html" .platform -}}</td>
<td>
{{- with index . "Level of Completion" }}
{{- partial "games/rows/release-date.html" .release_date }}
</td>
<td>
{{- with .level_of_completion }}
{{ . }}
{{- end -}}
</td>
<td>
{{- if index . "Date Started" -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Started" ) -}}
{{- with .date_started -}}
{{- time.Format "Jan 2, 2006" . -}}
{{- else -}}
Unknown
{{- end -}}&ndash;{{- if index . "Date Finished" -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Finished" ) -}}
{{- end -}}&ndash;{{- with .date_finished -}}
{{- time.Format "Jan 2, 2006" . -}}
{{- else -}}
Unknown
{{- end -}}
@ -77,14 +83,16 @@
</tr>
{{ end }}
{{ else if ( eq ( .Scratch.Get "listMode" ) "wishlist" ) }}
{{ range ( sort $.Site.Data.games.wishlist "Title" "asc" ) }}
{{ range ( sort $.Site.Data.games.wishlist "title" "asc" ) }}
<tr>
<td>TODO</td>
<td>{{ partial "games/rows/date_added.html" .date_added -}}</td>
<td>
{{- partial "cite" ( dict "c" . "g" $ "section" "games" "schemaType" "VideoGame" ) -}}
</td>
<td>{{ .Platforms }}</td>
<td>{{ index . "Date Released" }}</td>
<td>{{- partial "games/rows/platforms.html" .platform -}}</td>
<td>
{{- partial "games/rows/release-date.html" .release_date }}
</td>
</tr>
{{ end }}
{{ end }}