Generate a table of nethack entries from data/nethack/nutmeg.json
This commit is contained in:
parent
a5a226a5b3
commit
307a02eea1
3 changed files with 79 additions and 0 deletions
|
@ -1,6 +1,10 @@
|
|||
---
|
||||
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: true
|
||||
---
|
||||
|
||||
Herein is a chronological accounting of my descents into the Dungeons of Doom.
|
||||
|
||||
{{< nethack_table >}}
|
32
content/nethack/style.css
Normal file
32
content/nethack/style.css
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* Eryn Wells <eryn@erynwells.me> */
|
||||
|
||||
.logfile li {
|
||||
display: block;
|
||||
margin-block-start: 2rem;
|
||||
}
|
||||
|
||||
.logfile dt {
|
||||
margin-block-start: 2rem;
|
||||
}
|
||||
|
||||
table.stats {
|
||||
border: 0;
|
||||
width: 100%;
|
||||
-webkit-border-horizontal-spacing: 0;
|
||||
-webkit-border-vertical-spacing: 0;
|
||||
}
|
||||
|
||||
table.stats td {
|
||||
color: #aaa;
|
||||
font-size: 1.75rem;
|
||||
font-weight: 700;
|
||||
padding: 0;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
table.stats td.score,
|
||||
table.stats td.hp,
|
||||
table.stats td.level {
|
||||
width: 16rem;
|
||||
text-align: right;
|
||||
}
|
43
layouts/shortcodes/nethack_table.html
Normal file
43
layouts/shortcodes/nethack_table.html
Normal file
|
@ -0,0 +1,43 @@
|
|||
{{ $nethack_logfile := $.Site.Data.nethack }}
|
||||
|
||||
<dl class="logfile">
|
||||
{{ range sort $nethack_logfile.nutmeg.records "end_date" "desc" }}
|
||||
{{ if ne .reason_for_death "quit" }}
|
||||
<!-- <table class="logfile logentry">
|
||||
<tr>
|
||||
<td colspan=5>{{ time.Format "January 2, 2006" .end_date }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="name" colspan=4>{{ .name }}, a {{ .alignment | lower }} {{ .race | lower }} {{ .gender | lower }} {{ .role }},
|
||||
died {{ if gt .number_of_deaths 1 }}for the last time{{ end }} in <span class="nobreak">{{ .dungeon_name }}</span>
|
||||
on <span class="nobreak">{{ if gt .level 0 }}{{ .level_descriptive | lower }}{{ else }}{{ .level_descriptive }}{{ end }}</span>.
|
||||
{{ if eq .reason_for_death "quit" }}She quit.{{ else }}She was {{ .reason_for_death }}.{{ end }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="began">Began {{ time.Format "January 2, 2006" .start_date }}</td>
|
||||
<td class="score">{{ .score }} points</td>
|
||||
<td class="level">Level {{ .max_level }}</td>
|
||||
<td class="hp">{{ if gt .hit_points 0 }}{{ .hit_points }} / {{ end }}{{ .max_hit_points }} hp</td>
|
||||
</tr>
|
||||
</table> -->
|
||||
<dt class="start-date">{{ time.Format "January 2, 2006" .end_date }}</dt>
|
||||
<dd class="logentry">
|
||||
{{ .name }}, a {{ .alignment | lower }} {{ .race | lower }} {{ .gender | lower }} {{ .role }},
|
||||
died {{ if gt .number_of_deaths 1 }}for the last time{{ end }} in <span class="nobreak">{{ .dungeon_name }}</span>
|
||||
on <span class="nobreak">{{ cond (gt .level 0) (.level_descriptive | lower) .level_descriptive }}</span>.
|
||||
{{ cond (eq .reason_for_death "quit") "She quit." (printf "She was %s" .reason_for_death) }}.
|
||||
<table class="stats">
|
||||
<tr>
|
||||
<td class="began">Began {{ time.Format "January 2, 2006" .start_date }}</td>
|
||||
<td class="score">{{ .score }} points</td>
|
||||
<td class="level">Level {{ .max_level }}</td>
|
||||
<td class="hp">{{ cond (gt .hit_points 0) (printf "%s / %s" .hit_points .max_hit_points) .max_hit_points }} hp</td>
|
||||
</tr>
|
||||
</table>
|
||||
</dd>
|
||||
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</dl>
|
Loading…
Add table
Add a link
Reference in a new issue