diff options
| author | Hunter Kvalevog <hunter@kvog.sh> | 2026-08-29 21:16:01 -0500 |
|---|---|---|
| committer | Hunter Kvalevog <hunter@kvog.sh> | 2026-08-29 21:16:01 -0500 |
| commit | e3e8fc2d67770f9feda6527a21497cf40af40293 (patch) | |
| tree | 1adfe08765462c72dae4a849644031ac78cbb2f4 /layouts | |
| parent | 86b7b720dbea0e634f698e481f39dc41de822f80 (diff) | |
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_shortcodes/movie.html | 27 | ||||
| -rw-r--r-- | layouts/_shortcodes/movies.html | 10 |
2 files changed, 37 insertions, 0 deletions
diff --git a/layouts/_shortcodes/movie.html b/layouts/_shortcodes/movie.html new file mode 100644 index 0000000..58ac53b --- /dev/null +++ b/layouts/_shortcodes/movie.html @@ -0,0 +1,27 @@ +{{- $review := trim .Inner "\n\r\t " -}} +{{- $rating := "" -}} +{{- with .Get "rating" -}} + {{- $r := float . -}} + {{- $pct := div (mul (math.Min (math.Max $r 0) 5) 100.0) 5 -}} + {{- $rating = printf `<span class="movie-rating" role="img" aria-label="%v out of 5" title="%v / 5"><span class="movie-rating-fill" style="width:%v%%"></span></span>` $r $r $pct | safeHTML -}} +{{- end -}} +{{- if $review -}} +<details class="movie"> + <summary> + <span class="movie-caret">▸</span> + <span class="movie-title">{{ .Get "title" }}</span> + <span class="movie-director">{{ .Get "director" }}</span> + <span class="movie-date">{{ .Get "released" }}</span> + <span class="movie-rating-cell">{{ $rating }}</span> + </summary> + <div class="movie-review">{{ $review | markdownify }}</div> +</details> +{{- else -}} +<div class="movie movie-plain"> + <span></span> + <span class="movie-title">{{ .Get "title" }}</span> + <span class="movie-director">{{ .Get "director" }}</span> + <span class="movie-date">{{ .Get "released" }}</span> + <span class="movie-rating-cell">{{ $rating }}</span> +</div> +{{- end -}} diff --git a/layouts/_shortcodes/movies.html b/layouts/_shortcodes/movies.html new file mode 100644 index 0000000..51d95f7 --- /dev/null +++ b/layouts/_shortcodes/movies.html @@ -0,0 +1,10 @@ +<div class="movies"> + <div class="movies-head"> + <span></span> + <span>Title</span> + <span class="movie-director">Director(s)</span> + <span class="movie-date">Released</span> + <span class="movie-rating-cell">Rating</span> + </div> + {{ .Inner }} +</div> |