Generate a table of nethack entries from data/nethack/nutmeg.json

This commit is contained in:
Eryn Wells 2022-04-16 08:44:49 -07:00
parent a5a226a5b3
commit 307a02eea1
3 changed files with 79 additions and 0 deletions

View 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>