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