From 5606feeca1ba2ffb702c5ebb8afa2862bc2e7810 Mon Sep 17 00:00:00 2001
From: Eryn Wells
Date: Sun, 20 Nov 2022 12:24:14 -0800
Subject: [PATCH] Re-do a bunch of the styles for the Nethack page
---
content/nethack/index.md | 3 --
content/nethack/{style.css => nethack.css} | 34 ++++++++++++----------
layouts/_default/single.html | 11 +++++--
layouts/partials/nethack/logentry.html | 6 ++--
layouts/shortcodes/nethack/best_game.html | 6 ++--
layouts/shortcodes/nethack/logfile.html | 6 ++--
6 files changed, 38 insertions(+), 28 deletions(-)
rename content/nethack/{style.css => nethack.css} (70%)
diff --git a/content/nethack/index.md b/content/nethack/index.md
index 639194f..18cf6d6 100644
--- a/content/nethack/index.md
+++ b/content/nethack/index.md
@@ -2,9 +2,6 @@
title: "Nethack"
description: In which I play way too much of a silly command line Rogue-like game.
date: 2022-04-13T08:43:46-07:00
-draft: false
-type: simple
-rss_ignore: true
---
Every so often I get hooked on [this game][nethack]. It's a command line
diff --git a/content/nethack/style.css b/content/nethack/nethack.css
similarity index 70%
rename from content/nethack/style.css
rename to content/nethack/nethack.css
index d40bd62..49f97a3 100644
--- a/content/nethack/style.css
+++ b/content/nethack/nethack.css
@@ -5,12 +5,13 @@
--logentry-foreground-color: var(--tag-text-color);
}
-ol.logfile {
+.logfile {
margin-block-start: 0;
+ margin-inline-start: 0;
padding-inline-start: 0;
}
-.logentry {
+.logfile > li {
align-items: first baseline;
color: var(--logentry-foreground-color);
background-color: var(--logentry-background-color);
@@ -19,20 +20,21 @@ ol.logfile {
grid-template-columns: 32px auto auto;
row-gap: 1rem;
margin-block-start: 2rem;
+ margin-inline-start: 0;
padding: 3rem;
}
-.logentry .date {
+.logfile > li > .date {
grid-column-start: 2;
grid-row-start: 1;
}
-.logentry h4.date {
+.logfile > li > h4.date {
margin: 0;
padding: 0;
}
-.logentry .character-descriptor {
+.logfile > li > .character-descriptor {
color: #aaa;
font-size: 1.5rem;
font-weight: 700;
@@ -42,37 +44,37 @@ ol.logfile {
text-transform: uppercase;
}
-.logentry p {
+.logfile > li > p {
grid-column-start: 2;
grid-column-end: 4;
grid-row-start: 2;
margin: 0;
}
-.logentry .stats {
+.logfile > li > table.stats {
+ border: 0;
grid-column-start: 2;
grid-column-end: 4;
grid-row-start: 3;
-}
-
-.logentry table.stats {
- border: 0;
+ margin-block-end: 0;
width: 100%;
-webkit-border-horizontal-spacing: 0;
-webkit-border-vertical-spacing: 0;
}
-.logentry table.stats td {
+.logfile > li > table.stats > tbody > tr > td {
+ border: 0;
color: #aaa;
font-size: 1.5rem;
font-weight: 700;
padding: 0;
text-transform: uppercase;
+ vertical-align: bottom;
}
-.logentry table.stats td.score,
-.logentry table.stats td.hp,
-.logentry table.stats td.level {
+.logfile > li > table.stats > tbody > tr > td.score,
+.logfile > li > table.stats > tbody > tr > td.hp,
+.logfile > li > table.stats > tbody > tr > td.level {
width: 16rem;
text-align: right;
-}
\ No newline at end of file
+}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 3cf9292..a7e2963 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -2,6 +2,13 @@
{{ partial "single_main.html" . }}
{{ end }}
+{{ define "styles" }}
+ {{- range .Resources.Match "*.css" -}}
+ {{- $stylesheet := . | fingerprint "md5" }}
+
+ {{- end -}}
+{{ end }}
+
{{ define "scripts" }}
{{- if .HasShortcode "figures/railroad" -}}
{{- with partial "resources/railroad_utils.html" . -}}
@@ -11,10 +18,10 @@
{{- if .HasShortcode "figures/p5" -}}
{{- with partial "secure_asset.html" "scripts/lib/p5-1.5.0.js" -}}
-
+
{{- end -}}
{{- with partial "secure_asset.html" "scripts/sketch-utils.js" -}}
-
+
{{- end -}}
{{- end -}}
diff --git a/layouts/partials/nethack/logentry.html b/layouts/partials/nethack/logentry.html
index 95a738d..6ea1e6f 100644
--- a/layouts/partials/nethack/logentry.html
+++ b/layouts/partials/nethack/logentry.html
@@ -9,10 +9,12 @@
She was {{ .death.cause }}.
- Began {{ time.Format "January 2, 2006" .start_date }} |
+ {{- $startDate := time.Format "January, 02 2006" .start_date -}}
+ {{- $startDatetime := time.Format "2006-01-02" .start_date -}}
+ Began |
{{ .score | lang.FormatNumber 0 }} points |
Level {{ .character.max_level }} |
{{ cond (gt .character.hp.n 0) (printf "%s / %s" .character.hp.n .character.hp.max)
.character.hp.max }} hp |
-
\ No newline at end of file
+
diff --git a/layouts/shortcodes/nethack/best_game.html b/layouts/shortcodes/nethack/best_game.html
index a96084d..e02457a 100644
--- a/layouts/shortcodes/nethack/best_game.html
+++ b/layouts/shortcodes/nethack/best_game.html
@@ -3,6 +3,8 @@
{{ range $nethack_data }}
{{ $logfile = $logfile | append .logfile }}
{{ end }}
-
+
+ -
{{ partial "nethack/logentry.html" (index (sort $logfile "score" "desc") 0) }}
-
\ No newline at end of file
+
+
diff --git a/layouts/shortcodes/nethack/logfile.html b/layouts/shortcodes/nethack/logfile.html
index 1a3e921..430856a 100644
--- a/layouts/shortcodes/nethack/logfile.html
+++ b/layouts/shortcodes/nethack/logfile.html
@@ -4,11 +4,11 @@
{{ $logfile = $logfile | append .logfile }}
{{ end }}
- {{ range first 10 (sort $logfile "end_date" "desc") }}
+ {{ range sort $logfile "end_date" "desc" }}
{{ if ne .death.cause "quit" }}
- -
+
-
{{ partial "nethack/logentry.html" .}}
{{ end }}
{{ end }}
-
\ No newline at end of file
+